diff --git a/range2regex.go b/range2regex.go index 4942061..06b6dbf 100644 --- a/range2regex.go +++ b/range2regex.go @@ -99,17 +99,17 @@ func range2regex(start int, end int) (string, error) { // Last range - tmp to rangeEnd ranges = append(ranges, numRange{tmp, rangeEnd}) - regex := "(" + regex := string(NONCAPLPAREN_CHAR) // Generate the regex for i, rg := range ranges { if i > 0 { regex += "|" } - regex += "(" + regex += string(NONCAPLPAREN_CHAR) startSlc := intToSlc(rg.start) endSlc := intToSlc(rg.end) if len(startSlc) != len(endSlc) { - panic("Ranges have unequal lengths.") + return "", fmt.Errorf("Error parsing numeric range") } for i := range startSlc { if startSlc[i] == endSlc[i] {