Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Regex quiz

by Eureka_sg (Monk)
on May 12, 2001 at 21:32 UTC ( [id://79953]=perlmeditation: print w/replies, xml ) Need Help??

What's the difference between  /[0-z]+/ and  /\w+/?

Replies are listed 'Best First'.
Re: Regex quiz
by MrNobo1024 (Hermit) on May 12, 2001 at 21:36 UTC
    Highlight the box below if you want to see the answer...
    [0-z] contains the :;<=>?@[\]^` characters but \w dosen't. Also \w might contain other characters depending on your locale and whether you're using Unicode or not.
Re: Regex quiz
by MeowChow (Vicar) on May 12, 2001 at 21:38 UTC
    update: Answer despoiled in the spirit of quizing...

    [0-z] matches all ASCII characters between ordinals 48 and 122. This includes alot of symbols that aren't in the set matched by \w, which only includes letters, numbers, and the underscore [a-zA-Z0-9_].

       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
Re: Regex quiz
by stuffy (Monk) on May 13, 2001 at 14:05 UTC
    the first will answer any alphanumeric character, and the second will match any alphanumeric characther and the underscore?
    update guess I was wrong

    Stuffy

      First one takes ascii characters 0 to z, while second one is alphanumeric + underscore

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-16 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found