Retrieves the result of matching a string against a regular expression.
Syntax
str.match(regexp)Example
Enter values below to update the example in real time.
const→email→result→match→com→console→const email = "user@example.com";
const result = email.match(/[a-z]+@[a-z]+\.com/);
console.log(result?.[0]); // "user@example.com"