]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/threshold: regex cleanup
authorVictor Julien <vjulien@oisf.net>
Mon, 24 Jun 2024 09:06:10 +0000 (11:06 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 28 Jun 2024 07:46:34 +0000 (09:46 +0200)
src/detect-threshold.c

index 2748557a22f59adb3207b0d7c7d96570822f26bc..d368a8dbcbb2de4e761ca1bf9d7aafe944e90253 100644 (file)
 #include "util-cpu.h"
 #endif
 
+#define PARSE_REGEX_NAME  "(track|type|count|seconds)"
+#define PARSE_REGEX_VALUE "(limit|both|threshold|by_dst|by_src|by_both|by_rule|by_flow|\\d+)"
+
 #define PARSE_REGEX                                                                                \
-    "^\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_dst|by_src|by_both|by_rule|by_"   \
-    "flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_dst|by_src|by_"     \
-    "both|by_rule|by_flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_"   \
-    "dst|by_src|by_both|by_rule|by_flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|"  \
-    "threshold|by_dst|by_src|by_both|by_rule|by_flow|\\d+)\\s*"
+    "^\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE "\\s*,\\s*" PARSE_REGEX_NAME                 \
+    "\\s+" PARSE_REGEX_VALUE "\\s*,\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE                 \
+    "\\s*,\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE "\\s*"
 
 static DetectParseRegex parse_regex;