[英]Regex to match a word with numbers but not if it's numbers only
I would like to match a word that may contain numbers but not if it's numbers only. 我想匹配一个可能包含数字但不包含数字的单词。
For example: 例如:
Menial
= match Menial
= 比赛
John124
= match John124
= 比赛
V4n3ss4
= match V4n3ss4
= 匹配
0livia
= match 0livia
= 匹配
3715
= no match 3715
= 不匹配
I have tried \\w*
but surprisingly, this takes a plain number as a word. 我已经尝试过\\w*
但是令人惊讶的是,这需要一个普通数字作为单词。 I also tried other patterns with \\b
but I noticed that, for some reason, a single number is also considered a "word boundary". 我也用\\b
尝试了其他模式,但是我注意到,由于某种原因,单个数字也被视为“单词边界”。
Try: \\w*[a-zA-Z]\\w*
试试: \\w*[a-zA-Z]\\w*
This is essentially "At least one non-digit character surrounded by any number of alphanumeric characters" 本质上是“至少一个由任意数量的字母数字字符包围的非数字字符”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.