From 3b8dcd30f5aca7624a22cff85a2f767d8d1fb583 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Mon, 28 Jul 2025 01:20:01 -0400 Subject: Add regex operator Implemented regex operator using go flavored regular expressions. Added optimization to combine regex's in `OR` clauses. --- pkg/shell/interpreter.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/shell/interpreter.go') diff --git a/pkg/shell/interpreter.go b/pkg/shell/interpreter.go index bb0a441..c244c9e 100644 --- a/pkg/shell/interpreter.go +++ b/pkg/shell/interpreter.go @@ -86,6 +86,7 @@ var optimizations = []string{ "contradictions", "compact", "strictEq", + "mergeregex", } var commands = map[string]ITokType{ @@ -459,6 +460,8 @@ out: o.Compact() case "strictEq": o.StrictEquality() + case "mergeregex": + o.MergeRegex() default: suggestion, ok := util.Nearest( optName, @@ -781,6 +784,7 @@ func PrintHelp(w io.Writer) { fmt.Fprintln(w, " contradictions - zero contradicting statements and clauses") fmt.Fprintln(w, " strictEq - zero fuzzy/range statements when an eq is present") fmt.Fprintln(w, " tighten - zero redundant fuzzy/range statements when another mathes the same values") + fmt.Fprintln(w, " mergeregex - merge regexes") fmt.Fprintln(w, "compile (clause) - compile clause into query") fmt.Fprintln(w, "execute (artifact) - excute the compiled query against the connected database") fmt.Fprintln(w, "\nBare commands which return a value assign to an implicit variable _") -- cgit v1.2.3