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 a开发者_JAVA技巧nd simply be not rewritten.
I thought ^([^\.]+)
would 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?
^([^.]+)$
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.
精彩评论