summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2014-04-23 19:13:48 -0400
committergorhill <rhill@raymondhill.net>2014-04-23 19:13:48 -0400
commita557574d6c024ed6e36acc8b610f5f211c91568a (patch)
treec027b19ca8b823da90fd8e543dbc4177d26d9f45
parent815886d9f2740a2340d3c0d4023fa057e873a7a4 (diff)
downloadcronexpr-a557574d6c024ed6e36acc8b610f5f211c91568a.tar.xz
fixed regex, put back code block where it was1.0.0
-rw-r--r--cronexpr_parse.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/cronexpr_parse.go b/cronexpr_parse.go
index a1ab438..289ad53 100644
--- a/cronexpr_parse.go
+++ b/cronexpr_parse.go
@@ -179,7 +179,7 @@ var (
/******************************************************************************/
var (
- layoutWildcard = `^\*|\?$`
+ layoutWildcard = `^\*$|^\?$`
layoutValue = `^(%value%)$`
layoutRange = `^(%value%)-(%value%)$`
layoutWildcardAndInterval = `^\*/(\d+)$`
@@ -412,16 +412,6 @@ func genericFieldParse(s string, desc fieldDescriptor) ([]*cronDirective, error)
}
snormal := strings.ToLower(s[indices[i][0]:indices[i][1]])
- // `*/2`
- pairs := makeLayoutRegexp(layoutWildcardAndInterval, desc.valuePattern).FindStringSubmatchIndex(snormal)
- if len(pairs) > 0 {
- directive.kind = span
- directive.first = desc.min
- directive.last = desc.max
- directive.step = atoi(snormal[pairs[2]:pairs[3]])
- directives = append(directives, &directive)
- continue
- }
// `*`
if makeLayoutRegexp(layoutWildcard, desc.valuePattern).MatchString(snormal) {
directive.kind = all
@@ -439,7 +429,7 @@ func genericFieldParse(s string, desc fieldDescriptor) ([]*cronDirective, error)
continue
}
// `5-20`
- pairs = makeLayoutRegexp(layoutRange, desc.valuePattern).FindStringSubmatchIndex(snormal)
+ pairs := makeLayoutRegexp(layoutRange, desc.valuePattern).FindStringSubmatchIndex(snormal)
if len(pairs) > 0 {
directive.kind = span
directive.first = desc.atoi(snormal[pairs[2]:pairs[3]])
@@ -448,6 +438,16 @@ func genericFieldParse(s string, desc fieldDescriptor) ([]*cronDirective, error)
directives = append(directives, &directive)
continue
}
+ // `*/2`
+ pairs = makeLayoutRegexp(layoutWildcardAndInterval, desc.valuePattern).FindStringSubmatchIndex(snormal)
+ if len(pairs) > 0 {
+ directive.kind = span
+ directive.first = desc.min
+ directive.last = desc.max
+ directive.step = atoi(snormal[pairs[2]:pairs[3]])
+ directives = append(directives, &directive)
+ continue
+ }
// `5/2`
pairs = makeLayoutRegexp(layoutValueAndInterval, desc.valuePattern).FindStringSubmatchIndex(snormal)
if len(pairs) > 0 {