Code for validating email in java dating service mental patients
You could try to match for an extension, but there's no requirement for a file to have an extension.
There are probably dozens of way to format a phone number.
This will LEAVE the content of the tags within the string.
This regular expression will match all HTML tags and their attributes.
Generic Validator assert Generic Email("[email protected]") //valid email assert !
Generic Email("bhagwatintelligrape.com") // invalid email assert Generic Url(" //valid URL assert !
This regex will tolerate the form XXX XXX XXX, XXXXXXXX or XXX-XXX-XXX. Since every part of a path is separated by a \ character, we only need to find the last one.
Note that there's just no way to check if the last portion of a path is a file or a directory just by the name alone.
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.