A regular expression can check whether an entered email address has a plausible structure. It cannot prove that the mailbox exists, accepts mail, or belongs to the visitor. Verification normally requires sending a confirmation message or another application-specific verification step.
Dim re
Set re = New RegExp
The following intentionally practical pattern checks for a non-space local part, one @, and a dotted domain without trying to implement the entire email specification:
Dim email, isValid
Set re = New RegExp
re.Pattern = "^[^\s@]+@[^\s@]+\.[^\s@]+$"
re.IgnoreCase = True
re.Global = False
email = "reader@example.com"
isValid = re.Test(email)
Response.Write isValid
Examples that match this basic format:
reader@example.com, first.last@example.co.in, user+tag@example.org
Examples that fail the basic check:
reader.example.com, reader@, @example.com
Avoid over-restrictive regexes that reject legitimate addresses merely because they contain a plus sign, a long top-level domain, or another valid character your old pattern did not anticipate.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.