Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Explanation requested regarding negation of characters classes in perlretut

by gjb (Vicar)
on May 29, 2004 at 00:29 UTC ( #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-


Comment on Re: Explanation requested regarding negation of characters classes in perlretut
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://357390]
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: (13)
As of 2014-09-16 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (16 votes), past polls