summaryrefslogtreecommitdiff
path: root/re.go
diff options
context:
space:
mode:
Diffstat (limited to 're.go')
-rw-r--r--re.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/re.go b/re.go
index 4d3fa48..fab6386 100644
--- a/re.go
+++ b/re.go
@@ -6,17 +6,17 @@ import (
"strings"
)
-var ErrNotRE = errors.New("not re")
+var errNotRE = errors.New("not re")
func re(s, r string, global bool) (string, error) {
// min: at least two separators
if len(r) < 2 {
- return "", ErrNotRE
+ return "", errNotRE
}
z := strings.Split(r[1:], string(r[0]))
// match // and ///
if len(z) < 2 || len(z) > 3 {
- return "", ErrNotRE
+ return "", errNotRE
}
re, err := regexp.Compile(z[0])
if err != nil {
@@ -28,7 +28,7 @@ func re(s, r string, global bool) (string, error) {
}
return re.ReplaceAllStringFunc(s, func(b string) string {
if i != 0 {
- i -= 1
+ i--
return z[1]
}
return b