开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜