[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Change "WORD" to "Word"



Bart Lateur writes:
|>I'm trying to change words that are in all upercase to upper and lower.
|I've noticed a lot of solutions to this problem already, but none looks
|as simple as mine. So here goes:
|	s/(\w+)/\u\L$1/g;

That capitalizes the first letter of *every* word. You have to look for
an uppercase letter at the start of the word:

s/\b([A-Z]\w+)/\L\u$1\E/g;

Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch