Path matching with Javascript Regex
I'm having a hard time trying to figure a regex to match patterns of the form: path/to/file.htm开发者_如何学编程l but reject patterns of the form path/to/_file.html
Thx in advance for your help.
Try this :
/(?!.*/)[^_].+\.html$
I've made a couple of assumptions however:
- You can have anything in the path and to section (including underscore)
- You only want to reject underscore in the file section
- The file always ends in HTML
If any of these are wrong please comment and I'll modify appropriately.
精彩评论