sth has asked for the wisdom of the Perl Monks concerning the following question:
I think I'm missing something here, I hope someone can't tell me why this fails,
DB<6> $a = 'Apr-Jun03.zip~'; DB<7> p $a =~ /^[\w.-~]+$/ DB<8> p $a =~ /^[~\w.-]+$/ 1 DB<9> p $a Apr-Jun03.zip~ DB<10> p $a =~ /^[\w~.-]+$/ 1 DB<11> p $a =~ /^[\w.~-]+$/ 1
...so if I move the '~' off the end of the character class, the match works. I can't figure out why. Any ideas?
Thanks, sth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex - Char Class Question
by Enlil (Parson) on Dec 10, 2003 at 18:28 UTC | |
by diotalevi (Canon) on Dec 10, 2003 at 18:35 UTC | |
by sauoq (Abbot) on Dec 10, 2003 at 19:33 UTC | |
by sth (Priest) on Dec 10, 2003 at 18:43 UTC | |
by sth (Priest) on Dec 10, 2003 at 18:39 UTC |