Filter email address with regular expressions: I am new to regular expressions and was hoping someone might be able to help out.
I am trying to pattern match an email address string with the following format:
I want to be sure that there is a period somewhere before the ‘@’ character and that the characters after the ‘@’ character matches gmail.com
You want some symbols before and after the dot, so I would suggest
.+\..+@gmail\.com..+means any symbols (.) can appear 1 or more times (+)\.means the dot symbol; screened with backslash to suppress the special meaning of.@gmailandcomshould be matched exactly.See also Regular Expression Basic Syntax Reference
EDIT: gmail rules for account name only allow latin letters, digits, and dots, so a better regex is
[a-zA-Z0-9]+\.[a-zA-Z0-9]+@gmail\.com