I'm using the following regex to match all words:
mystr.replace(/([^\W_]+[^\s-]*) */g, function (match, p1, index, title) {...}
Note that words can contain special characters like German Umlauts. How can I match all words excluding those inside parentheses?
If I have the following string:
here wäre c'è (don't match this one) match this
I would like to get the following output:
here
wäre
c'è
match
this
The trailing spaces don't really matter. Is there an easy way to achieve this with regex in javascript?
EDIT: I cannot remove the text in parentheses, as the final string "mystr" should also contain this text, whereas string operations will be performed on text that matches. The final string contained in "mystr" could look like this:
Here Wäre C'è (don't match this one) Match This