/\A[^\x00-\x1f\x7f&*?|\\"'`<>{}()[\]]+\z/
# allows space and "safe" punctuation
Of course, that still doesn't address the question of bytes outside the 7-bit ascii range, which includes the whole domain of utf8 wide characters. For that part of the issue, there isn't enough information in the OP to provide a basis for appropriate advice. (Would utf8 file names be allowable/sensible? What is expectable/possible regarding non-ascii content in the input strings?) | [reply] [d/l] |