Anneq has asked for the wisdom of the Perl Monks concerning the following question:
"Because a period is a metacharacter, it needs to be escaped to match as an ordinary period. Because, for example, \d and \w are sets of characters, it is incorrect to think of [^\d\w] as [\D\W]; in fact [^\d\w] is the same as [^\w], which is the same as [\W]. Think DeMorgan's laws."
My question is, why is it incorrect to think of [^\d\w] as [\D\W]?
UPDATE
While gjb and scooterm explained it clearly, (I realized after the fact), I still didn't get it, duh! Zaxo's explanation turned on the light bulb. Thanks to all. Next stop, google for DeMorgan's laws. Thank's to BrowserUK for giving me something to play with.Anne
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Explanation requested regarding negation of characters classes in perlretut
by Zaxo (Archbishop) on May 29, 2004 at 01:11 UTC | |
|
Re: Explanation requested regarding negation of characters classes in perlretut
by gjb (Vicar) on May 29, 2004 at 00:29 UTC | |
|
Re: Explanation requested regarding negation of characters classes in perlretut
by dimar (Curate) on May 29, 2004 at 01:10 UTC | |
|
Re: Explanation requested regarding negation of characters classes in perlretut
by BrowserUk (Patriarch) on May 29, 2004 at 01:16 UTC |