I wanted to check the file name along with its full path. I tried some regular expressions as shown below, but none of them worked correctly.
^(?:[\w]\:|\\)(\\[a-z_\-\s0-9\.]+)+\.(txt|gif|pdf|doc|docx|xls|xlsx)$
and
^(([a-zA-Z]\:)|(\\))(\\{1}|((\\{1})[^\\]([^/:*?<>""|]*))+)$
etc...
My requirements are given below: Suppose that if the file name is "c: \ Demo.txt", then it should check all the possibilities, for example, if you do not include a double slash ( c:\\Demo\\demo.text), there is no additional colon ( c::\Demo\demo.text). You should accept UNC files such as ( \\staging\servers) and other checks. Please help. I am really stuck here.
source
share