Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: New to perl and regex

by Athanasius (Abbot)
on Nov 19, 2012 at 02:15 UTC ( #1004468=note: print w/ replies, xml ) Need Help??


in reply to New to perl and regex

if($line =~ /\s*([a-zA-Z]+\s*)+\s*(-?\d\d?)\s*/) ^

The problem description specifies “at least 1 or more white space” between the last word and the integer, but the regex has \s* (which is zero or more). This should be \s+ (one or more).

Apart from that, it’s difficult to offer advice without more information. Specifically, how is the code failing?

As Kenosis says, please provide some sample data (along with the desired output).

Athanasius <°(((><contra mundum


Comment on Re: New to perl and regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (16)
As of 2015-07-31 21:52 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 (282 votes), past polls