Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Splitting on non-initial uppercase without split

by si_lence (Deacon)
on Jan 26, 2005 at 10:22 UTC ( #425161=note: print w/replies, xml ) Need Help??

in reply to Splitting on non-initial uppercase without split

If I get you right you want to have a blank before each
capital letter except the first one in the string. Right?
If yes use
$s =~ s/.(?=[A-Z])/ /g;

The comment of edan is right (sorry to mess it up)
but this should work
$s =~ s/(.)(?=[A-Z])/$1 /g;


Replies are listed 'Best First'.
Re^2: Splitting on non-initial uppercase without split
by edan (Curate) on Jan 26, 2005 at 10:43 UTC

    Erm, no. That's going to turn "LikeThis" into "Lik This"


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://425161]
[ambrus]: No, you're not doing anything wrong. It's just that our automatic spam filters confuse you with the spammers who post advertisments for online shops of counterfeit branded clothing.
[ambrus]: Or unless you left the title field empty or entered a very short title for the node, but then you'd get a message saying that.
[ambrus]: I hope Corion or some other admin is here and can check the logs to see what the problem is.
[mz2255]: I wish I had an online shop but sadly no. The title field definitly wasn't short, had a perl module in the title with 5-6 additional words.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-10-19 15:32 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (255 votes). Check out past polls.