I’m trying to use Regex to get certain strings within opening and closing double parentheses which may include parentheses within them:
For example, if I have the following string,
((Display String (Extra Parens)))((Another one))((And Another with (HAAH)))((ONE MORE (YES) HAHA)))))))
((Haha))
I am hoping the first matching group (.*?) will capture:
Display String (Extra Parens)
Another one
And Another with (HAAH)
ONE MORE (YES) HAHA)))))
I haven’t been able to figure this out, but here’s where I’ve been trying to get my desired result:
https://www.phpliveregex.com/p/LCV#tab-preg-match-all
With a greedy quantifier with each on its own line, it works:
https://www.phpliveregex.com/p/LCW#tab-preg-match-all
But what about if it’s all on one line? How do I get the matching group results to match the greedy results when on the same line using a lazy quantifier?