Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Regex to strip, keep, or add—depending

by JediWizard (Deacon)
on Aug 06, 2005 at 16:46 UTC ( [id://481517]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex to strip, keep, or add—depending
in thread Regex to strip, keep, or add—depending

FYI... The example I gave will not have issues with nested parens. * (being greedy) would match the last paren followed by a semi-colon (thus nested parens would not be an issue (unless there were nested parens with in the nested function call)).

Further proving my point that the perl parser will handle more than you would ever want to try with a regex.

Update: I am wrong. The regex I posted will actually match the first ) followed by a ;... which will break in a nested function call. However nested parens aside... my original point, that you (porbably) do not want to attempt to account for everything the perl parser will account for, remains valid.


They say that time changes things, but you actually have to change them yourself.

—Andy Warhol

Replies are listed 'Best First'.
Re^3: Regex to strip, keep, or add—depending
by chester (Hermit) on Aug 06, 2005 at 17:27 UTC
    I'm in full agreement, it's unlikely that any regex will work in all cases. Mine certainly doesn't. Catching nested parens would be as far as I'd want to take it; if I was doing this for my own purposes, probably not even that far. But I wanted to try it for educational purposes (educating myself, that is).
      PPI

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found