作者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