On Tue, 15 Dec 2015 00:16:41 +0000, Jakob Ovrum wrote: > Is there a way to do balanced match with std.regex? > > Example (from [1]): > > test -> funcPow((3),2) * (9+1) > > I want to match the funcPow((3),2) bit, regardless of the depth of the > expression in funcPow(*). > > https://stackoverflow.com/questions/7898310/using-regex-to-balance- match-parenthesis > [1]
I don't think so. std.regex looks like it implements only a deterministic finite automaton, whereas what you are looking for requires a push-down automaton. It just so happens that a few popular regex libraries implement PDAs rather than DFAs (and have associated changes to their regex syntax to make it work, albeit inelegantly).