in reply to matching file names using regex

/^test\d{1,}(.*[^~])?$/
the hard part is that, based on your description, the pattern should match "test1" and not match "test1~". so a plain [^~] at the end doesn't work, because the requires another character after the 1 digit, which should be optional. so the whole thing is optional.

question: how does /^test\d+/.*/ work? i've seen regexes matches with 3 delims before but never quite got it

perl -e'$_="nwdd\x7F^n\x7Flm{{llql0}qs\x14";s/./chr(ord$&^30)/ge;print'