Given this exact string:
Name = "John" AND Country = "USA"
I want two matches returned:
Name
Country
I want to match all unquoted whole words as long as they are not in a short list of defined words (e.g. AND
, OR
)
This wil开发者_如何学Gol be used in a .NET environment.
This will match any word consisting of alphanumeric and _
characters that is not terminated by a "
. Excluding the |
delimited elements in the (?! )
.
It should serve your purposes.
(?<!")\b(?!excludethis|andthis|andthisone|andthat|thistoo|AND)\w+\b(?!")
Warning, this will match Tome
and and
in Country = "Sao Tome and Principee"
精彩评论