正则表达式查找部分前缀,但不是完整前缀后跟数字
RegEx to find partial prefix, but not full prefix followed by a number
我的 RegEx "FUN(\d{0,20})"
捕获的内容比预期的要多一些。它应该 return 只是特定标签 "FUN"
后面的数字。我如何更改它以避免 "WordsEndingWithFUN"
后面的数字?请参见下面的示例。区分大小写在这里并不重要。
FUN12|, blaFUN123 # matched 12
ooopsFUN12 ; FUN1245 # matched 1245
ooopsFUN ; FUN13 # matched 13
FUN, blaFUN123 # nothing is matched
blaFUN123 # nothing is matched
添加单词边界,并将条件更改为至少包含 1 个数字:
\bFUN(\d{1,20})
我的 RegEx "FUN(\d{0,20})"
捕获的内容比预期的要多一些。它应该 return 只是特定标签 "FUN"
后面的数字。我如何更改它以避免 "WordsEndingWithFUN"
后面的数字?请参见下面的示例。区分大小写在这里并不重要。
FUN12|, blaFUN123 # matched 12
ooopsFUN12 ; FUN1245 # matched 1245
ooopsFUN ; FUN13 # matched 13
FUN, blaFUN123 # nothing is matched
blaFUN123 # nothing is matched
添加单词边界,并将条件更改为至少包含 1 个数字:
\bFUN(\d{1,20})