[英]python regex for multiple words not matching
So I have a regex like this - 所以我有一个这样的正则表达式-
[\w\s.<>/]* is [boom|box|cat]+[\w\s<>/]+[fun|lame][\w\s<>./]*
but this matches 但这匹配
<something>things/something> is brah <HELLO>loc</HELLO> suburb.
why? 为什么?
[...]
is a character class, it will match any individual character between the brackets, ie your [boom|box|cat]
is identical to [abcotx|]
. [...]
是一个字符类,它将匹配方括号之间的任何单个字符,即您的[boom|box|cat]
与[abcotx|]
相同。 You want (boom|box|cat)
and (fun|lame)
. 您需要
(boom|box|cat)
和(fun|lame)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.