Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: pattern matching nested { }'s

by Gerard (Pilgrim)
on Mar 02, 2004 at 10:28 UTC ( [id://333208]=note: print w/replies, xml ) Need Help??


in reply to Re: pattern matching nested { }'s
in thread pattern matching nested { }'s

Thanks for your reply. I think I was a little unclear in my original post. Only the { } immediately after onValidate should match. For example:
onValidate { stuff in here { other stuff } }
should all be removed and
keep this { remove this {and {this}} }
should all be kept.

Thanks, Gerard.

Replies are listed 'Best First'.
Re: Re: Re: pattern matching nested { }'s
by Caron (Friar) on Mar 02, 2004 at 10:34 UTC

    Well, in that case, just say it to your replacement command:

    $text =~ s/(onValidate)\s*$re/$1/g; # or even $text =~ s/(?<=onValidate)\s*$re//g; print $text;

    It gives:

       onValidate
       keep this
       {
           remove this {and {this}}
       }
    

Log In?
Username:
Password:

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

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

    No recent polls found