/
(?############ Let's catch paths without "" or '' ############################
)(?<opening>(?# First, catch the starting path, the <opening> ###################
)\b(?<montage>[a-zA-Z]:[\/\\])(?# montage = 'C:/'
)|[\/\\][\/\\](?<!http:\/\/)(?<!https:\/\/)(?>(?# check not 'http[s]:' prefix
)[?.][\/\\](?:[^\/\\<>:"|?\n\r ]+[\/\\])?(?# '//[?or.]/xxxxx' or '//[?or.]/server/'
)(?&montage)?(?# '//[?or.]/c:/' or '//[?or.]/server/c:/'
)|(?!(?&montage)))(?# '//[addressIP/ or serverName/ but not C:/]'
)|%\w+%[\/\\]?(?# '%EnvVariable%[/]'
))(?# So, <opening> catch :
'C:/' or
'//[?or.]/[UNC/]C:/' or
'//[?or.]/[UNC/]' or
'//[next characters must be something other than C:/]' or
'%EnvironementVariable%[/]'
)(?:(?# now, we catch each directory name wich is between [/] ########################
)[^\/\\<>:"|?\n\r ,'](?# the first character should not be [ ,']
)[^\/\\<>:"|?\n\r]*(?# Any pathFrendly character
)(?<![ ,'])(?# The last directory name's character must not be [ ,']
)[\/\\](?# End of directory name - who are between '/' -
))*(?# Catch most 'directoryName/' as possible
)(?:(?# Lets catch the End path. There is a file ? a directory ? or just a useless '/' ?
)(?=[^\/\\<>:"'|?\n\r;, ])(?#if next character is not pathFriendly or ' ' or [,'], we have reach the end of the path => we don't catch the last '/' and the the Regex end now.
You can't catch fileName who begin by [,'] because they are probably a delimiter between 2 path. but '.' is allowed
)(?:(?#If we are here, that mean there is a fileName or directoryName to catch
######