Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: How do I replace a substring (if exists) with a different substring in a string?by tachyon (Chancellor) |
on Jul 20, 2001 at 15:43 UTC ( [id://98373]=note: print w/replies, xml ) | Need Help?? |
You can use a s/// regex like this:
The quotemeta lets you find strings that contain regex meta characters and the /g at the end of the s/// does all occurances. cheers tachyon
In Section
Seekers of Perl Wisdom
|
|