Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created August 17, 2023 16:21
Show Gist options
  • Save suhailgupta03/0a5614114d8cd51bb0e8ade907fc5655 to your computer and use it in GitHub Desktop.
Save suhailgupta03/0a5614114d8cd51bb0e8ade907fc5655 to your computer and use it in GitHub Desktop.
let string = `Hi! Recently India celebrated its
Independence Day.`
let pattern = /[ezx]/g
// here g means global
// it is used to find all the matches
console.log(pattern.test(string));
// test method returns true if the pattern is
// found in the string
// false if not found
// match
let o = string.match(pattern)
console.log(o);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment