Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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
Replies are listed 'Best First'.
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 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 GrandFather (Sage) 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 (Chancellor) 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 chanting in the Monastery: (9)
As of 2015-07-30 08:39 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 (270 votes), past polls