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

A regular expression

by enttoobad (Novice)
on Mar 22, 2012 at 13:23 UTC ( #961008=perlquestion: print w/ replies, xml ) Need Help??
enttoobad has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Is anyone able to explain what this perl regex matches?

"999[89]\$"

Many thanks

Comment on A regular expression
Download Code
Re: A regular expression
by JavaFan (Canon) on Mar 22, 2012 at 13:27 UTC
    Any string that contains either 9998$ or 9999$.
      great, thanks very much!
Re: A regular expression
by dorko (Parson) on Mar 22, 2012 at 13:38 UTC
    I use YAPE::Regex::Explain to explain Regular Expressions:
    use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/999[89]\$/)->explain(); __END__ The regular expression: (?-imsx:999[89]\$) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- 999 '999' ---------------------------------------------------------------------- [89] any character of: '8', '9' ---------------------------------------------------------------------- \$ '$' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

    Cheers,

    Brent

    -- Yeah, I'm a Delt.
      that's a handy tool, thanks!
Re: A regular expression
by GrandFather (Cardinal) on Mar 22, 2012 at 20:15 UTC

    You should take a good look at least at perlretut, and probably at some of the other Perl regular expression documentation.

    True laziness is hard work
Re: A regular expression
by planetscape (Canon) on Mar 24, 2012 at 22:54 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-12-27 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (176 votes), past polls