in reply to Re: can u suggest a regex for this ?
in thread can u suggest a regex for this ?
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 (Curate) on Feb 03, 2023 at 16:31 UTC |