Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add word boundary check to period tokenizer regex. #2

Merged
merged 1 commit into from

2 participants

@fschaefer

When only a millisecond based period is provided (e.g. "45 milliseconds"), the period is recognized as minutes ("45m").
This commit adds a word boundary check to the tokenizer regex to distinguish between minutes and milliseconds.

@fschaefer fschaefer Add word boundary check to period tokenizer regex.
When only a millisecond based period is provided (e.g. "45 milliseconds"), the period is recognized as minutes ("45m").
This commit adds a word boundary check to the tokenizer regex to distinguish between minutes and milliseconds.
e897c5b
@ChiperSoft ChiperSoft merged commit eb025bd into ChiperSoft:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 28, 2012
  1. @fschaefer

    Add word boundary check to period tokenizer regex.

    fschaefer authored
    When only a millisecond based period is provided (e.g. "45 milliseconds"), the period is recognized as minutes ("45m").
    This commit adds a word boundary check to the tokenizer regex to distinguish between minutes and milliseconds.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  timed.js
View
2  timed.js
@@ -42,7 +42,7 @@
if (isNaN(parseInt(period,10))) period = '1'+period;
- var match = period.toLowerCase().replace(/[^a-z0-9\.]/g, "").match(/(?:(\d+(?:\.\d+)?)(?:days?|d))?(?:(\d+(?:\.\d+)?)(?:hours?|hrs?|h))?(?:(\d+(?:\.\d+)?)(?:minutes?|mins?|m))?(?:(\d+(?:\.\d+)?)(?:seconds?|secs?|s))?(?:(\d+(?:\.\d+)?)(?:milliseconds?|ms))?/);
+ var match = period.toLowerCase().replace(/[^a-z0-9\.]/g, "").match(/(?:(\d+(?:\.\d+)?)(?:days?|d))?(?:(\d+(?:\.\d+)?)(?:hours?|hrs?|h))?(?:(\d+(?:\.\d+)?)(?:minutes?|mins?|m\b))?(?:(\d+(?:\.\d+)?)(?:seconds?|secs?|s))?(?:(\d+(?:\.\d+)?)(?:milliseconds?|ms))?/);
if (match[0]) {
parsed.when =
Something went wrong with that request. Please try again.