Created
January 5, 2016 06:50
-
-
Save espl-saket/9dce833f7992e7cc3759 to your computer and use it in GitHub Desktop.
Regex to extract string and number from a combination of both
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
var stringPattern = /[A-Za-z]+/g; | |
var numberPattern = /\d+/g; | |
'This10Is200'.match(stringPattern); | |
// Returns ["This", "Is"] | |
'This10Is200'.match(numberPattern); | |
// Returns ["10", "200"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment