I have something like this:
Othername California (2000) (T) (S) (ok) {state (#2.1)}
Is there a regex code to obtain:
Other
Despite what I have said in the comments. I've found a way around:
(?(?=\([^()\w]*[\w.]+[^()\w]*\))\([^()\w]*([\w.]+)[^()\w]*\)|.)(?=[^{]*\})|(?
Explanation:
(? # If
(?=\([^()\w]*[\w.]+[^()\w]*\)) # There is (anything except [()\w] zero or more times, followed by [\w.] one or more times, followed by anything except [()\w] zero or more times)
\([^()\w]*([\w.]+)[^()\w]*\) # Then match it, and put [\w.] in a group
| # else
. # advance with one character
) # End if
(?=[^{]*\}) # Look ahead if there is anything except { zero or more times followed by }
| # Or
(?
Online demo