views:

76

answers:

1

I am using URL Rewrite module 2 in IIS 7.

I have a certain rule for rewriting URLs in IIS. But I want that rule to apply to only strings that DO NOT contain a DOT (.) If the string contains a DOT, I want it to fail and simply be not rewritten.

I thought this will work - ^([^.]+) but it rejects only strings that start with a DOT.

Examples:

"projects", "about", "contact" should be matched.

"script.js", "default.css" should be rejected.

What is the regular expression I should use?

+1  A: 
^([^.]+)$

Your expression is missing the "$" to match the end of the string, so it is successfully matching 1+ occurrences of a non-DOT character and calling it a day.

Colin Cochrane