As the title says... :)
Could you help me to build a regex to match a strings NOT containing "au开发者_StackOverflow社区=1"?
I was playing with negative lookahead with no luck but I'm quite sure that I should get something using that.
Thanks!
Using negative lookbehind:
?<!au=1
Negative lookahead will only look ahead, making the regex match
match against au=1match
. You should read up on the differences in more detail here.
You can also just match against au=1
and negate the result:
if(!Regex.IsMatch(input, @"au=1"))
{
// blah blah blah
}
Prefix the pattern with !
to negate it:
!au=1
I finally did it with this regexp
^(?!.*au=1).*$
精彩评论