the cases are
- compulsory '\' char at the first
- followed by alphanumeric
- compulsory '\' char at the last
eg:\abc\bvc\
\abc4\abc3\abc2\abc1\
the cases are
eg:\abc\bvc\
\abc4\abc3\abc2\abc1\
Use ^
to match the begging of the string and $
to match the end of the string. Then use character class with word character.
The following allows only the alphanumeric characters
^\\[\w\\]+\\$
and then following allows any character.
^\\.+\\$
Try this:
^\\(.+\\)+$
This requires \ at the beginning and end. Also can have multiple words for a single folder name. Also allows one or more folders.
Of course there are many more valid folder paths that don't meet this regex. This regex allows characters that are not valid for folder names; not sure what all the limitations are for folder names. See this question for a discussion on valid folder names.