Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: capturing matching parenthesis

by melora (Scribe)
on Apr 16, 2004 at 17:59 UTC ( #345834=note: print w/replies, xml ) Need Help??


in reply to capturing matching parenthesis

The times I've had to cope with nested parentheses, I've used recursion -- call the recursion routine when you encounter the open paren (excellent point about the "\(" sequence, by the way), and return when you encounter the close paren (of course, there's the escape sequence there, too), resuming at the point beyond the close paren, in the original string.. I do like the idea of populating the tree structure with it, too, depending on the analysis you need to do on the whole expression. But then, I'm an old C programmer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://345834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2023-06-08 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (35 votes). Check out past polls.

    Notices?