Created
October 23, 2012 09:11
-
-
Save ychaouche/3937786 to your computer and use it in GitHub Desktop.
regular expressions in javascript example
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
| var myString = "0h 1m 40s", | |
| matches = myString.match(/(\d+)h (\d+)m (\d+)s/), | |
| hours = matches[1], | |
| mins = matches[2], | |
| secs = matches[3]; | |
| console.debug(hours, mins, secs); | |
| console.debug(matches); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment