I was trying out to create a regular expression to match file path in java like
C:\\abc\\def\\ghi\\abc.txt
I tried this ([
If it has to match only the path of files lying on the same machine where your app is running, then you can use:
try{
java.nio.file.Paths.get(yourPath);
}(catch InvalidPathException err){
}
So if you're running your app on windows the code above will catch invalid windows paths and if you're running on unix, it will catch invalid unix paths, etc.