comment regexps

This commit is contained in:
Mike Barrett 2012-12-15 22:51:48 +00:00
parent e1bac3ffb9
commit e28eb0f09f

View File

@ -71,14 +71,14 @@
unitsRegExp = '(' + unitsRegExp = '(' +
unitsRegExp unitsRegExp
.replace(/,/g, '|') .replace(/,/g, '|') // convert commas to pipes
.replace('|', '') .replace('|', '') // removing leading pipe
+ ')'; + ')';
// split string into groups and get total seconds for each group // split string into groups and get total seconds for each group
var groups = string var groups = string
.replace(/[^\w+-]+/g, '') // remove white space .replace(/[^\w+-]+/g, '') // remove white space
.match(/[-+]?[0-9]*\.?[0-9]+\D/g); .match(/[-+]?[0-9]*\.?[0-9]+\D/g); // match time groups (digit followed by time unit - i.e 5d 15m = 2 time groups)
if (groups !== null) { if (groups !== null) {
for(var group in groups) { for(var group in groups) {