Created
August 18, 2023 14:46
-
-
Save suhailgupta03/86346c5471c8607df7ce346aaeffb92e 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 = "Anish is a student with alma better. So is Subrojyoti"; | |
let pattern = /[a-z]/g | |
// [a-z] means any character from a to z | |
// [A-Z] means any character from A to Z | |
// [0-9] means any character from 0 to 9 | |
console.log(string.match(pattern)); | |
let stringNew = "My age is 23. I was born in 1997"; | |
let patternNew = /[0-9]/g | |
// [0-9] is a range that matches any character from 0 to 9 | |
console.log(stringNew.match(patternNew)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment