diff --git a/processor/regex.go b/processor/regex.go index 9bd3472..c8adf6e 100644 --- a/processor/regex.go +++ b/processor/regex.go @@ -53,7 +53,7 @@ func ProcessRegex(content string, command utils.ModifyCommand, filename string) processRegexLogger.Error("Error compiling pattern %q: %v", pattern, err) return commands, fmt.Errorf("error compiling pattern: %v", err) } - processRegexLogger.Debug("Compiled pattern successfully in %v", time.Since(patternCompileStart)) + processRegexLogger.Debug("Compiled pattern successfully in %v. Pattern: %s", time.Since(patternCompileStart), pattern) // Same here, it's just string concatenation, it won't kill us // More important is that we don't fuck up the command @@ -335,6 +335,9 @@ func resolveRegexPlaceholders(pattern string) string { pattern = strings.ReplaceAll(pattern, "!any", `.*?`) resolveLogger.Debug("Replaced !any with non-greedy wildcard") + pattern = strings.ReplaceAll(pattern, "\n", "\r?\n") + resolveLogger.Debug("Added optional carriage return support for Windows line endings") + repPattern := regexp.MustCompile(`!rep\(([^,]+),\s*(\d+)\)`) // !rep(pattern, count) repeats the pattern n times // Inserting !any between each repetition