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|]
. You want (boom|box|cat)
and (fun|lame)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.