开发者

Link Check Regex

I want to make sure there are at least 1 characters before the finial dot, then make sure sure the开发者_高级运维re is atleast 2 characters after the final dot...

link_regex = /^.+\..+$/i;

Doesn't work like that, I thought the .+ would be greedy and grab everything up to the last final dot.


link_regex = /^.+\.[^.]{2,}$/i;

[^.] is any non-period character; {2,} says "2 or more".


Huh? It works, but not exactly what you said - it will accept one character before and one character after the last dot. You need ^.+\.[^.]{2,}$ for what you described.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜