Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created October 23, 2012 09:11
Show Gist options
  • Select an option

  • Save ychaouche/3937786 to your computer and use it in GitHub Desktop.

Select an option

Save ychaouche/3937786 to your computer and use it in GitHub Desktop.
regular expressions in javascript example
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