Validating a file with regular expressions

validating a file with regular expressions-48validating a file with regular expressions-16validating a file with regular expressions-61

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.

This free Java regular expression tester lets you test your regular expressions against any entry of your choice and clearly highlights all matches. Consult the regular expression documentation or the regular expression solutions to common problems section of this page for examples. You can create range of characters using the hyphen character such as A-Z (A to Z).

If you need more examples or solutions, please contact me. Note that in character sets, special characters (., *, ) do not have any special meaning. This means match anything that is a single white space character OR anything that is not a white space character!

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.