用了二年的Regular Expression,直到最近看到這篇文章http://darkk6.blogspot.com/2017/03/regexp-lookahead-lookbehind.html 才知道Lookahead與Lookbehind的用法。
請教,有一段字串12345 XD Hi12345678ab666666cd98765432,要找出6位到8位數,但不可以是9位數。
因此會找到12345678 和 666666;但不可以找出 987654321 中的 98765432 或者 87654321。
在支援Lookbehind的情況下,Pattern可以設為(?<!\d)\d{6,8}(?!\d)
請教,若系統不支援Lookbehind,Pattern要如何設定?