The exec()
method executes a search for a match in a string. It returns an array of matches, or null
if no match is found.
Example:
const regex = /\d+/;
console.log(regex.exec('abc123')); // ['123']
Tags: basic, JavaScript, regular expressions
URL: https://www.tiktok.com/@jsmentoring/photo/7456816176019082529