Last active
September 26, 2019 13:30
-
-
Save juanrules/7efcb8680af482a71ec8f1bf3b8c16e6 to your computer and use it in GitHub Desktop.
Useful Regex patterns
This file contains 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
const fragment = 'hello:222'; | |
const fragment = 'hello:222]'; | |
// Get any number at the end of a string | |
const anyDigitsFromEndOFString = /\d+$/g; | |
console.log(fragment.match(anyDigitsFromEndOFString)); // ["222"] | |
console.log(fragment2.match(anyDigitsFromEndOFString)); // null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment