过滤Windows下保留的文件名称正则表达式
C++语法下实测:
^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\\.[^.]*)?$)[^<>:\"/\\\\|?*\\x00-\\x1F]*[^<>:\"/\\\\|?*\\x00-\\x1F\\ .]$
bool editJsonFileNameandSolutionName::isValidFileName(const QString& fileName) { static QRegularExpression regex("^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\\.[^.]*)?$)[^<>:\"/\\\\|?*\\x00-\\x1F]*[^<>:\"/\\\\|?*\\x00-\\x1F\\ .]$"); return regex.match(fileName).hasMatch(); }

浙公网安备 33010602011771号