我需要“测试”后到来的特定字符串匹配JavaScript的正则表达式匹配任何
- 前提是有一个(所以避免匹配“测试”独)
- ,避免比赛如果该字符串是专门字母 “L”
像这样
testing rest -> matches (rest)
testing what -> matches (what)
testing Loong -> matches (Loong)
testing N -> matches (N)
testing L -> this is not matched
testing LL -> matches (LL)
testing J -> matches (J)
testing -> this is not matched
testing -> this is not matched
testing L TY -> this specific string will not occur so it is irrelevant
并加上引号
"testing rest" -> matches (rest)
"testing what" -> matches (what)
"testing Loong" -> matches (Loong)
"testing N" -> matches (N)
"testing L" -> this is not matched
"testing LL" -> matches (LL)
"testing J" -> matches (J)
"testing" -> this is not matched
"testing "-> this is not matched
"testing L TY" -> this specific string will not occur so it is irrelevant
我该怎么做?
也许['/ ^“?testing(。{2,}?)”?$ /'](https://regex101.com/r/wI8cY2/2)? –
好吧,也许['/ ^“?testing((?!\ s * L?\ s * $)。*?)”?$ /'](https://regex101.com/r/wI8cY2/3) ? –
'/ ^“(testing(?:)?。*)”$ /' - https://regex101.com/r/cW1dK1/2 – ThePerplexedOne