“File path” is one of the patterns that you can select on the Match panel. With this pattern you can match a file path on a Windows or UNIX file system. Linux and macOS use UNIX file systems.
One handy aspect of the “file path” pattern is that it accepts a file path in any of the file path flavors that RegexMagic supports. This flavor can be a different one than the regex flavor used by the application you have selected on the Regex panel. RegexMagic automatically converts the file path from the flavor you specified in the pattern to the flavor selected on the Regex panel.
This example shows how to generate a regular expression that checks whether a string contains a valid absolute path on a local Windows drive or a Windows network share. You can find this example as “Pattern: file path” in the RegexMagic library.
c: c:\ c:\folder c:\folder\ c:\file.txt c:\folder1\folder2 c:\folder1\folder2\ c:\folder1\folder2\file.txt c:\folder name\file name.txt \\SERVER\SHARE \\SERVER\SHARE\ \\SERVER\SHARE\folder \\SERVER\SHARE\folder\ \\SERVER\SHARE\file.txt \\SERVER\SHARE\folder1\folder2 \\SERVER\SHARE\folder1\folder2\ \\SERVER\SHARE\folder1\folder2\file.txt \\SERVER\SHARE\folder name\file name.txt
button to add field
.
\A(?:[a-z]:|\\\\[@%._~a-z0-9-]{1,63}\\[$@%._~a-z0-9-]{1,80})\\(?:(?!\.+\\)[^\n\r"*<>?|:\\/]+\\)*[^\n\r"*<>?|:\\/]+\.[]!#$%&'()+,0-9;=@\[_`a-z{}~^-]{1,3}\ZRequired options: Case insensitive; Exact spacing.
c: c:\ c:\folder c:\folder\ c:\file.txt c:\folder1\folder2 c:\folder1\folder2\ c:\folder1\folder2\file.txt c:\folder name\file name.txt \\SERVER\SHARE \\SERVER\SHARE\ \\SERVER\SHARE\folder \\SERVER\SHARE\folder\ \\SERVER\SHARE\file.txt \\SERVER\SHARE\folder1\folder2 \\SERVER\SHARE\folder1\folder2\ \\SERVER\SHARE\folder1\folder2\file.txt \\SERVER\SHARE\folder name\file name.txt