score:0

Accepted answer

You could achieve your goal by using regular expressions. See Regex.Match Method. You can transform your selected string from the dropdown list into a regular expression then use the Match method in your LINQ query.

Regex r = new Regex(String.Format ("Customer {0} has {1} orders", "([^\s]+)",  "([^\s]+)"));

This code:

o.CustomField.Contains(searchString)

can then be changed to:

r.Match(o.CustomField).Success

score:0

Just do a Regex.Replace on {\d+}, replacing it with *.

Something like:

string s = Regex.Replace(input, @"{\d+}", "*");

score:0

Try the approach mentioned here Or use combination of field.StartsWith("Customers") && field.EndsWith("orders") && field.Contains("has")


Related Articles