Created
December 11, 2013 21:56
-
-
Save cgkio/7919200 to your computer and use it in GitHub Desktop.
match/return first word with REGEX
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
REGEX: match/return first word (before space) | |
var string = '130,000 037037032032'; | |
var regex = /^\S*/g; | |
var result = string.match(regex); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment