in reply to Search for a character in CAPS
Untested code rocks. :) dvergin is absolutely correct, this code will not work. I will leave it as is, to serve as a warning to others about posting without testing. Thanks for the lesson, dvergin. :)
And now back to our regular show...
</update>
I would try something like:
Which should insert a space in front of each capital letter, except if it is at the start of the string (the dot makes sure there must be at least one letter of any kind in front of the matched uppercase letter).$agent =~ s/.([A-Z])/ $1/g;
If you don't want to insert when there are capital letters standing together, like in CIA => C I A, you could try something like:
Which should make sure it matches an uppercase letter, that is preceded with anything but an uppercase letter.$agent =~ s/[^A-Z]([A-Z])/ $1/g;
Hope I understood the question correctly. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Search for a character in CAPS
by dvergin (Monsignor) on Mar 07, 2002 at 16:58 UTC | |
by c_lhee (Novice) on Mar 08, 2002 at 09:18 UTC |