Reputation: 2013
I'm using a regex expression to match from a list of strings:
/(Art|Dance|Writing|Theater \(Musical\))/g
The problem I'm running into is that single-word strings "Art", "Dance", "Writing", etc. match perfectly, but I can't figure out how to match "Theater (Musical)". Everything tip I've found is for matching any string that can contain spaces, but I need it to only be from the given list.
I believe the software we're using uses the javascript regex flavor, if that makes any difference.
Upvotes: 0
Views: 2373
Reputation:
The regex in your question is correct and will match the input Theater (Musical)
.
It also will correctly match even if you have the i
case insensitive flag set. (Of course, it will also match THEATER (mUsIcAl)
etc. in that case).
There must have been some other issue with your code or input data.
Upvotes: 4