Created
August 17, 2023 16:21
-
-
Save suhailgupta03/0a5614114d8cd51bb0e8ade907fc5655 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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