A simple pattern for common cases
For learning and typical forms, a compact pattern can check local part, @, domain, and suffix.
Regex: ^[\w.-]+@[\w.-]+\.[A-Za-z]{2,}$\nMatches: dev@example.com\nRejects: dev@, @example.comUnderstanding each part
[\w.-]+ accepts a sequence of word characters, dots, or hyphens. @ is literal. The domain follows a similar structure, and \. requires a literal dot before a suffix of at least two letters.
Why this is not universal email validation
The real email syntax contains edge cases that short teaching patterns deliberately omit. A syntactically plausible value also does not prove that the mailbox exists.
For real signups, combine reasonable format checking with email confirmation.
Test negative cases
Include missing usernames, missing domain suffixes, spaces, and malformed separators. Negative examples reveal over-permissive patterns quickly.
Next step: test it for real
Use the Playground to experiment with the pattern, then practice in the game with feedback on false positives and false negatives.