Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Explanation requested regarding negation of characters classes in perlretut

by gjb (Vicar)
on May 29, 2004 at 00:29 UTC ( [id://357390]=note: print w/replies, xml ) Need Help??


in reply to Explanation requested regarding negation of characters classes in perlretut

The point is that \D is the set of all characters that do not belong to \d, so 'a', 'C', '&' all belong to \D. Now similar for \W, the set of all characters not in \w, hence '&', ' ', etc.

So far so good, but [\D\W] is the union of the sets \D and \W, hence it will contain '&' and ' ', but also 'a' and 'C' since the latter are members of \D. That's definitely not equal to the set [^\d\w] that contains none of the characters in \d or \w. The set [^\d\w] definitely doesn't contain 'a' or 'C' that are members of [\D\W].

Hope this helps, -gjb-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357390]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-04-19 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found