Let's look at a repetition based metacharacter, plus (+). It checks if the previous character (from the position of +) in the string appears one or more times from that position.
xxxxxxxxxx13
// Adding a function to wrap the existing codefunction findMatch() { let s = "Zoooooootopia"; let pattern = /Zo+topia/; if (pattern.test(s)) { console.log("Found a match!"); } else { console.log("Did not find a match."); }}// Driver code to execute the functionfindMatch();OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment



