Created
August 18, 2023 14:58
-
-
Save suhailgupta03/80ad5a4e5a68251a966984255671a7fb 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 = "Enjoying my day at the beach! #beachday #day1"; | |
let pattern = /\w/g | |
// \w means any word character (equal to [a-zA-Z0-9_]) | |
// which means that \w includes underscore | |
// anything between a-z | |
// anything between A-Z | |
// anything between 0-9 | |
console.log(string.match(pattern)); | |
let patternNumber = /\d/g | |
// \d means any digit (equal to [0-9]) | |
// Earlier we wrote as /[0-9]/g | |
console.log(string.match(patternNumber)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment