Bringing back some regex golf for this fine Thursday. Your goal for today is to create a regex that matches the text between two sets of parentheses. If there are multiple sets of parentheses in the string then your regex should have no problem with that either.
Comments:
StephenAlanBuckley - 11 years, 1 month ago
I have
/[^\(]*\(([^\)]*)/
But that won't get nested parentheses.reply permalink
Jason Brady - 11 years, 1 month ago
Regular expressions can't match properly nested parentheses, at least not an undefined number of them. I think the best you can do for this problem is below. It will match the first and last, and anything in between.
reply permalink
Nick Krichevsky - 11 years, 1 month ago
in the string (test) toast (tacos)
This matches test and tacos.
reply permalink