Novice regular expression question
I was wonderi开发者_如何学JAVAng, how do I create create a regular expression that allows me to use something akin an "or" statement. For example,
^\w+? [\s?] OR [\\w\\W]*?]$
where the brackets represent the condition.
Like this:
(thing1|thing2)
This will match either "thing1" or "thing2" - see here for more info.
In your example it would be:
^(\w+? [\s?]|[\w\W]*?])$
Use a |
between your groups.
精彩评论