I am trying to make an field that uses a pattern to check if the input is a valid windows file path.
The pattern I have is
You only need to escape the characters in the character class that must be escaped otherwise, you will always get this error.
Use
pattern="(?:\w:|\\)(\\[\w\s.()~!@#$%^&=+';,{}[\]-]+)+\.exe"
See the JSFiddle
Details:
] inside the character class must be escaped[ and . must not be escaped: must never be esacaped, it is never a special character[a-zA-Z0-9_] = \wpattern is always anchored by default, you need no ^ and $ anchors.