作者laudieh (laudieh)
看板RegExp
标题[问题] 若想排除 .php 结尾的字串要如何下?
时间Wed Mar 19 01:47:17 2008
大大好: 小弟想要一个字串,但是它要排除 .php 做结尾的字串才行
ex: xyz123 abc.tw abc.xyz 这些都可过关
但要阻挡 test.php 的字串,不知要如何下?
^(.*[^.][^p][^h][^p])$ 可是这样会让 xxxxp 的字串过不了哩!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 211.72.212.138
1F:推 LyinZ:^.*(?<!\.php)$ 03/19 03:19
2F:推 bcse:可以讲解一下 ?<! 是什麽意思吗? 03/19 06:19
3F:推 LyinZ:perldoc说是 zero-width negative look-behind assertion @@ 03/19 13:45