Posts

Showing posts from July, 2018

Create Regular Expression for Email Validation

Regular Expression Pattern Eg :- /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ Please find each character attribute information of above expression below. Character Description / .. / All regular expressions start and end with forward slashes. ^ Matches the beginning of the string or line. \w+ Matches one or more word characters including the underscore. Equivalent to [A-Za-z0-9_]. [\.-] \ Indicates that the next character is special and not to be interpreted literally. .- matches character . or -. ? Matches the previous character 0 or 1 time. Here previous character is [.-]. \w+ Matches 1 or more word characters including the underscore. Equivalent to [A-Za-z0-9_]. * Matches the previous character 0 or more times. ([.-]?\w+)* Matches 0 or more occurrences of [.-]?\w+. \w+([.-]?\w+)* The sub-expression \w+([.-]?\w+)* is used to match the username in the email. It begins with at least one or more word characters including the underscore, equivalent to [A-Za-z0-9_...