I am a bit confused by regex syntax. I need to build two separate Regex patterns that detects whether a filename is legal in windows. One is that matches any word except these chars (illegal characters) -
*"< > : " / \ | ? "
And the second pattern is that matches any word except these words (reserved file names) -
PRN, AUX, CLOCK, NUL, CON, COM, LPT
I found combined version of this pattern that looks like this @"^(?!(?:PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d)(?:\..+)?$)[^\x00-\x1F\xA5\\?*:\"";|\/<>]+(?<![\s.])$"
, but the key thing is that I need to separate these two.
Could anyone help me? Thank you in advance.