c# - regex to validate server path -
i can't seem find regex or other means validate sever path here server path must exist in following format when arguments c# console app:
@"\\myserver\testfolder\tests\"
i must have \\
@ beginning
this how passing value
myapp.exe "\\myserver\testfolder\tests\"
ty np
i came following. allows characters such _
, .
, , -
in names, might want adjust depending on server/share names like. requires server , share name, , makes directory within share optional.
^\\\\[\w\-.]+\\[\w\-.]+\\[\w\-.\\]*$ ^\\\\ --> double-backslash @ beginning [\w\-.]+\\ --> server name (at least 1 character) followed backslash [\w\-.]+\\ --> share name (at least 1 character) followed backslash [\w\-.\\]*$ --> directories (0 or more characters including backslashes)
Comments
Post a Comment