Validating a file with regular expressions
Your user interface should take care of the formatting problem by having a clear documentation on the format and/or split the phone into parts (area, exchange, number) and/or have an entry mask.
The following expression is pretty lenient on the format and should accept 999-999-9999, 9999999999, (999) 999-9999.
This free regular expression tester lets you test your regular expressions against any entry of your choice and clearly highlights all matches.
It is Java Script based and uses XReg Exp library for enhanced features.
It's a bit confusing, because "\" is required both to escape characters in the Java String, and also within the expression itself.
You want to validate that the file only contains a number?
This regular expression will match all HTML tags and their attributes.So, I would like to write a piece of code that checks for the presence of special characters (pretty much everything other than a-z, A-Z, 0-9, _, -) in the file path or file name; and accordingly perform rest of the activities.