Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Pattern Matching

by pavunkumar (Scribe)
on Aug 13, 2009 at 08:37 UTC ( #788157=perlquestion: print w/ replies, xml ) Need Help??
pavunkumar has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks
if(/[^\d\D]/) { print "match" }

it is getting match dot "." character how ... ?

Thanks

Comment on Pattern Matching
Download Code
Re: Pattern Matching
by Anonymous Monk on Aug 13, 2009 at 08:53 UTC
    use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/[^\d\D]/)->explain; __END__ The regular expression: (?-imsx:[^\d\D]) 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): ---------------------------------------------------------------------- [^\d\D] any character except: digits (0-9), non- digits (all but 0-9) ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
    any character except digits and non-digits is every character.
      No. Any character except digits or non-digits would be every character. With and, this regexp will never match.
        I think i was trying to say: Any charater except every character.
Re: Pattern Matching
by grizzley (Chaplain) on Aug 13, 2009 at 10:27 UTC
    No it doesn't. At least on my machine... :)
    /[^\d\D]/ in my opinion will never match.
      I think you're right :)
      printf "(%s) match (%d)\n",$_, 0+/[^\d\D]/ for qw[ !! aa AA 11 99 )( :D .. ]; __END__ (!!) match (0) (aa) match (0) (AA) match (0) (11) match (0) (99) match (0) ()() match (0) (:D) match (0) (..) match (0)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-05-23 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (467 votes), past polls