Hi there,
I hope someone can help, cause I'm lost...
First of all I am working with C# and I have a (legacy) Regex I need to adjust. Actually I am using Regex.Replace to match an expression in a string and Replace it.
My current Regex.Replace looks like this:
query = Regex.Replace(query, @"title\s*(?<Operator>(=|>|<|<>))(\s|')*(?<Title>([a-z]|[A-Z]|\-\*|%)+)'*", new MatchEvaluator(TitleEvaluator));
my question really is about the regular expression:
title\s*(?<Operator>(=|>|<|<>))(\s|')*(?<Title>([a-z]|[A-Z]|\-\*|%)+)'*
it matches something along the lines of:
title=bike%
However it doesn't match:
title=james bought two bikes
I need a Regex that DOES match the latter string, BUT if the string contains " and " or " or " only the part before and/or should match.
E.g. if I have the following string:
title=james bought two bikes and body=two bikes
I need a regular expression that matches "title=james bought two bikes" and leaves off " and body=two bikes".
Any help is greatly appreciated!!