Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: can u suggest a regex for this ?

by misterperl (Pilgrim)
on Feb 03, 2023 at 16:20 UTC ( [id://11150134]=note: print w/replies, xml ) Need Help??


in reply to Re: can u suggest a regex for this ?
in thread can u suggest a regex for this ?

I just went back and ++'ed your reply JO , this is a game-changer. This construct has myriad applications in general.

I'm always looking for ways to shorten code- its generally more maintainable, easier to read, and more reliable. This is a huge win to modify certain BLOCKS of text, in one statement.

Like to change all "dog"s to "canine" only in XML pet blocks I might use: map {/^<pets>/ .. /^<\/pets>/ ? s/dog/canine/gir : $_ } @a;

TY you made my month. I never knew how to do this ; I've tried all sorts of approaches over the years like regex assertions, etc.

++ to you for sure ; Id do ++^^10 if I could!

Replies are listed 'Best First'.
Re^3: can u suggest a regex for this ?
by jo37 (Deacon) on Feb 03, 2023 at 16:31 UTC

Log In?
Username:
Password:

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

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

    No recent polls found