I am trying to match an expression of type
field:"value"
but not
field:value
I have written
([a-z]+)\s*?:\s*?"(.+)"\s*?
and this works excepts in dotNet
Is there any reason why this might be? Something I am missing?
Edit -- I typed the question wrong (figures)
I'm trying to match
field:value
but not
field:"value"
This is the regex I have
(?<field>[a-z]+)\s*?:\s*?(?<value>[^"].+[^"])\s*?
But that's not working, it matches even what's in quotes.
Edit 2:
Below is the code --
SearchResources.StringRegexNotQuotedText
is ([a-z]+)\s*?:\s*?([^"]+)\s*?
stringQuery
is (what: "Hello_bob"
)
All relevant things are escaped....
Regex regexNotQuoted = new Regex(SearchResources.StringRegexNotQuotedText, RegexOptions.IgnoreCase);
MatchCollection matchesNotQuoted = regexNotQuoted.Matches(stringQuery);
// It should go into this block if the value is not in quotes
if (regexNotQuoted.IsMatch(stringQuery))
{
}