Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: problems splitting string

by VSarkiss (Monsignor)
on Dec 15, 2005 at 16:05 UTC ( #517000=note: print w/ replies, xml ) Need Help??


in reply to problems splitting string

You want to split on a space only if followed by a digit, correct? This will do the trick:

@res = split /\s(?=\d)/, $string;
If there can be more than one digit, change that to:
@res = split /\s(?=\d+)/, $string;
You can find more on zero-width assertions in perlre.


Comment on Re: problems splitting string
Select or Download Code
Replies are listed 'Best First'.
Re^2: problems splitting string
by Anonymous Monk on Dec 15, 2005 at 16:08 UTC
    thanks for the help

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2015-07-29 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls