in reply to Re: matching file names using regex
in thread matching file names using regex

The benefit for two checks is that each rule can be tuned separately. You might realize there are a number of weird endings that you don't like, such as m{ [#@$.~] $ }x.

The negative aspect of using two regex to check legality is that it's a bit harder to supply a rule in a configuration file, such as those used by spam filters, etc. If your code can't handle two supplied regex, then you'll have to figure out one.

A negative look-behind is useful.

print if m{ ^ # begins with test # 'test' \d+ # a number .*? # nothing or anything else (?<! ~ ) # but no '~' at the tail $ # to the end }ix;

--
[ e d @ h a l l e y . c c ]