Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 ... ?


Replies are listed 'Best First'.
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)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://788157]
Approved by vinoth.ree
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-04-20 02:02 GMT
Find Nodes?
    Voting Booth?