← All Exercises

Email Regex Validator

intermediatejavascript~15min

Background

Email validation is one of the most common regex use cases in form processing and user input validation.

Problem

Write a function that takes a string and returns whether it matches a valid email address format using a regular expression.

Input

A string to validate as an email address.

Output

A boolean indicating whether the string matches email format.

Sample tests

Sample 1

Input: "[email protected]"
Expected: true

Your solution

Learning objective

Practice regex pattern construction and understand email format validation trade-offs.