Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Find a pattern

by ikegami (Pope)
on Jan 28, 2011 at 09:50 UTC ( #884760=note: print w/replies, xml ) Need Help??


in reply to Re: Find a pattern
in thread Find a pattern

What you wrote is 'a one to nine digits, then space, then the word "failed"'.

No. /\d{1-9}/ matches a digit followed by a "{" followed by a "1" followed by a "-" followed by a "9" followed by a "}".

To match any number (for some definition of number), /\d+/ would do.

Replies are listed 'Best First'.
Re^3: Find a pattern
by elef (Friar) on Jan 28, 2011 at 10:30 UTC
    To make this answer a little more helpful:
    The correct expression to match "a series of 1 to 9 digits" is:
    /\d{1,9}/ or /[0-9]{1,9}/ - note the comma, not dash

    1 to 9 digits between 1 and 9:
    /[1-9]{1,9}/

    Any number of digits between 1 and 9: /[1-9]+/
Re^3: Find a pattern
by fisher (Priest) on Jan 28, 2011 at 10:27 UTC
    Oh, thank you, my fault; I saw comma inplace of dash

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://884760]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2018-07-16 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (342 votes). Check out past polls.

    Notices?