4
rated 0 times
[
10]
[
6]
/ answers: 1 / hits: 52302
/ 13 Years ago, wed, july 27, 2011, 12:00:00
I want to match all strings ending in .htm unless it ends in foo.htm. I'm generally decent with regular expressions, but negative lookaheads have me stumped. Why doesn't this work?
/(?!foo).htm$/i.test(/foo.htm); // returns true. I want false.
What should I be using instead? I think I need a negative lookbehind expression (if JavaScript supported such a thing, which I know it doesn't).
More From » regex