A2Z-F21
A2Z-F21 copied to clipboard
Regular Expression Example from class
const regex = /<p>(.*?)<\/p>/g;
const str = 'Hi <p>my name is</p> Dan and I am <p>teaching</p>.';
let matchInfo = regex.exec(str);
let matches = [];
while (matchInfo !== null) {
matches.push(matchInfo[1]);
matchInfo = regex.exec(str);
}
console.log(matches);