Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm a newbie to perl and I need some help with regular expressions to do some string manipulation.
The first thing I want to be able to do is add a space where there are capital letters, except right at the beginning of a sentence. At first I thought split would work, but this removes the capital letter. This is basically what I want to achieve:
HelloMyNameIsJake = Hello My Name Is Jake
The second thing I want to do is reduce all whitespace to a single space char. So any number of single spaces, tabs or newlines would become just " ".
I would be grateful if anyone out there can help me with this and perhaps give me a break down of what you have done so I understand it for the future.
Many thanks, Jake
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: addd spaces after caps & reduce whitespace to single space
by esskar (Deacon) on Feb 19, 2005 at 15:28 UTC | |
Re: addd spaces after caps & reduce whitespace to single space
by ambrus (Abbot) on Feb 19, 2005 at 15:38 UTC | |
Re: addd spaces after caps & reduce whitespace to single space
by betterworld (Curate) on Feb 19, 2005 at 16:18 UTC | |
Re: addd spaces after caps & reduce whitespace to single space
by sh1tn (Priest) on Feb 19, 2005 at 15:33 UTC | |
by prasadbabu (Prior) on Feb 19, 2005 at 15:37 UTC | |
by sh1tn (Priest) on Feb 19, 2005 at 16:06 UTC | |
by Tanktalus (Canon) on Feb 19, 2005 at 16:21 UTC | |
|