看板
[ RegExp ]
討論串[問題] 關於regular expression
共 7 篇文章
內容預覽:
blahblahbla blaquantifier 後面的問號只是讓這個 quantifier 改 match 最短字串。/b[^a].*a/ 的 .* 會 match ahblahbl. /b[^a].*?a/ 的 .*? 會 match 空字串. --. 芸曰:「今世不能,期以來世。」. 余曰:
(還有57個字)
內容預覽:
一般的 quantifier (*, +, {n}, {n,}, {n,m}) 會 match 最長字串,. 而在 quantifier 後面接 ? 是叫它 match 最短字串。. 例如 "blahblahblah":. /b.*a/ -> "blahblahbla". /b.*?a/ -> "b
(還有41個字)