python正则表达式,多个单词不匹配

时间:2014-02-14 23:44:04

标签: python regex

所以我有这样的正则表达式 -

[\w\s.<>/]* is [boom|box|cat]+[\w\s<>/]+[fun|lame][\w\s<>./]*

但匹配

<something>things/something> is brah <HELLO>loc</HELLO> suburb.

为什么?

1 个答案:

答案 0 :(得分:3)

[...]是一个字符类,它将匹配括号中的任何单个字符,即您的[boom|box|cat][abcotx|]相同。您需要(boom|box|cat)(fun|lame)