Validating a file with regular expressions
Therefore, with the above regex expression for finding phone numbers, it would identify a number in the format of 123-123-1234, 123.123.1234, or 1231231234.
In the case of including the "\" character in the regular expression, you will need to escape both of them, so you have "\\".
In the regex, "." is any character and "*" means "0 or more times".
So .*[ ].* would mean a space surrounded by any other characters Square brackets  match any of the alternative characters within them ^ (as first character inside the square brackets) means "NOT these characters" \w means word-characters, i.e.
A-Za-z0-9 and _ Certain characters like [ and ] need to be escaped with a \ for more info see Wikipedia regular expressions Thanks so much Luigi for such detailed explanation. With the code snippet that you have given, I can perform the check on individual file name or folder name.
But I want to validate the whole file path, which contains '\' as file separator.