diff --git a/timestring.js b/timestring.js index 23c3c2e..fc1dee1 100644 --- a/timestring.js +++ b/timestring.js @@ -71,14 +71,14 @@ unitsRegExp = '(' + unitsRegExp - .replace(/,/g, '|') - .replace('|', '') + .replace(/,/g, '|') // convert commas to pipes + .replace('|', '') // removing leading pipe + ')'; // split string into groups and get total seconds for each group var groups = string .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) { for(var group in groups) {