rrwo has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to perform a search and replace regular expression which preserves the case of the word as best as possible using the following rules:
What's the best way to do this? I can think of some ugly hacks that check the case of the word, set a flag, and then adjust it afterwards. But I assume there's a better way.
Any Regexp gurus out there with good ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Case-preserving regexp search and replace?
by japhy (Canon) on Aug 26, 2001 at 21:03 UTC | |
by rrwo (Friar) on Aug 31, 2001 at 08:33 UTC | |
by japhy (Canon) on Aug 31, 2001 at 09:26 UTC | |
|
Re: Case-preserving regexp search and replace?
by chipmunk (Parson) on Aug 26, 2001 at 21:50 UTC | |
|
Re: Case-preserving regexp search and replace?
by dga (Hermit) on Aug 26, 2001 at 21:19 UTC |