more useful options | |
PerlMonks |
Re: Search and replace regex, but only retain a portion of the stringby kschwab (Vicar) |
on Dec 23, 2018 at 20:18 UTC ( [id://1227644]=note: print w/replies, xml ) | Need Help?? |
If the rules are "change any sequence of characters that isn't a-zA-Z into a single underscore", you might like tr// better than a regex:
Still needs the second pass to get rid of MSRN_, but clean and straightforward otherwise. Edit: I see someone already updated another comment node to suggest this, apologies for the dupe.
In Section
Seekers of Perl Wisdom
|
|