Negative lookahead Regular Expression

The problem is pretty simple really. This will do it:

/^(?!.*foo\.htm$).*\.htm$/i.test("/foo.htm"); // returns false

Leave a Comment