Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

Hi
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;

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

si_lence


Comment on Re: Splitting on non-initial uppercase without split
Select or Download Code
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"

    --
    edan

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://425161]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-26 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls