看板
[ RegExp ]
討論串[問題] 不包含連續字串XXX
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
不好意思 找了好久都找不到答案 來問個笨問題. 例如 PHP 的 preg_match ( $pattern , $subject , $matches ). 如果要 match $subject 裡不包含某「連續字串」的正規表示式要怎麼寫?. 像是有兩句話 this is not ok 和 thi
(還有31個字)
內容預覽:
你需要了解的是 lookahead and lookbehind 的概念:. http://www.regular-expressions.info/lookaround.html. 以你的範例來說,表示式可以寫成這樣:. /this is (?!not)ok/. 這意思是,要比對 this、一個空
(還有12個字)
首頁
上一頁
1
下一頁
尾頁