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