in reply to How would you write this RegExp?

I might approach the problem slightly differently, with an inverted character class:

c:\@Work\Perl\monks>perl -wMstrict -le "use constant NOT_ALLOWED => qr{ [^-\x27\x23\$\@0-9a-zA-Z.\\/_%(){}&!~ +`^] }xms; ;; for my $str ('', qw(ABC_ABC 'A' ///?/// =*+| ABC=), ' ', qq{\t +\r\n}) { my $status = 0 + $str =~ NOT_ALLOWED; print qq{[$str] $status}; } " [] 0 [ABC_ABC] 0 ['A'] 0 [///?///] 1 [=*+|] 1 [ABC=] 1 [ ] 1 [ ] 1
Note that: (And a lot more test cases wouldn't be a bad idea.)


Give a man a fish:  <%-{-{-{-<