Skip to content

Commit

Permalink
Merge pull request #3 from 0xn3va/regex
Browse files Browse the repository at this point in the history
Fixed regex functions
  • Loading branch information
Mzack9999 authored Jun 13, 2022
2 parents 68f0f64 + 86f04fd commit 4b30366
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ func HelperFunctions() (functions map[string]govaluate.ExpressionFunction) {
}

functions["regex"] = func(args ...interface{}) (interface{}, error) {
compiled, err := Regex(toString(args[0]))
compiled, err := Regex(toString(args[1]))
if err != nil {
return nil, err
}

return compiled.MatchString(toString(args[1])), nil
return compiled.MatchString(toString(args[0])), nil
}

functions["regex_all"] = func(args ...interface{}) (interface{}, error) {
Expand All @@ -184,7 +184,7 @@ func HelperFunctions() (functions map[string]govaluate.ExpressionFunction) {
if err != nil {
return nil, err
}
if !compiled.MatchString(toString(args[1])) {
if !compiled.MatchString(toString(args[0])) {
return false, nil
}
}
Expand All @@ -197,7 +197,7 @@ func HelperFunctions() (functions map[string]govaluate.ExpressionFunction) {
if err != nil {
return nil, err
}
if compiled.MatchString(toString(args[1])) {
if compiled.MatchString(toString(args[0])) {
return true, nil
}
}
Expand Down

0 comments on commit 4b30366

Please sign in to comment.