feat: regexp2

This commit is contained in:
Adlyq
2023-09-03 22:00:37 +08:00
parent 2092a481b3
commit 3fd954d185
4 changed files with 28 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
package rewrites
import (
"regexp"
regexp "github.com/dlclark/regexp2"
"strings"
C "github.com/Dreamacro/clash/constant"
@@ -22,7 +22,7 @@ func ParseRewrite(line string) (C.Rewrite, error) {
err error
)
urlRegx, err = regexp.Compile(strings.Trim(url, " "))
urlRegx, err = regexp.Compile(strings.Trim(url, " "), regexp.None)
if err != nil {
return nil, err
}
@@ -50,7 +50,7 @@ func ParseRewrite(line string) (C.Rewrite, error) {
rulePayload = rs[0]
break
} else {
ruleRegx, err = regexp.Compile(rs[0])
ruleRegx, err = regexp.Compile(rs[0], regexp.None)
if err != nil {
return nil, err
}