Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b74e4724d4 | |||
| 30246fd626 |
@@ -53,7 +53,7 @@ func ProcessRegex(content string, command utils.ModifyCommand, filename string)
|
|||||||
processRegexLogger.Error("Error compiling pattern %q: %v", pattern, err)
|
processRegexLogger.Error("Error compiling pattern %q: %v", pattern, err)
|
||||||
return commands, fmt.Errorf("error compiling pattern: %v", 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
|
// Same here, it's just string concatenation, it won't kill us
|
||||||
// More important is that we don't fuck up the command
|
// More important is that we don't fuck up the command
|
||||||
@@ -77,7 +77,7 @@ func ProcessRegex(content string, command utils.ModifyCommand, filename string)
|
|||||||
processRegexLogger.Debug("Pattern complexity estimate: %d", patternComplexity)
|
processRegexLogger.Debug("Pattern complexity estimate: %d", patternComplexity)
|
||||||
|
|
||||||
if len(indices) == 0 {
|
if len(indices) == 0 {
|
||||||
processRegexLogger.Warning("No matches found for regex: %q", pattern)
|
processRegexLogger.Warning("No matches found for regex: %s", pattern)
|
||||||
processRegexLogger.Debug("Total regex processing time: %v", time.Since(startTime))
|
processRegexLogger.Debug("Total regex processing time: %v", time.Since(startTime))
|
||||||
return commands, nil
|
return commands, nil
|
||||||
}
|
}
|
||||||
@@ -335,6 +335,9 @@ func resolveRegexPlaceholders(pattern string) string {
|
|||||||
pattern = strings.ReplaceAll(pattern, "!any", `.*?`)
|
pattern = strings.ReplaceAll(pattern, "!any", `.*?`)
|
||||||
resolveLogger.Debug("Replaced !any with non-greedy wildcard")
|
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+)\)`)
|
repPattern := regexp.MustCompile(`!rep\(([^,]+),\s*(\d+)\)`)
|
||||||
// !rep(pattern, count) repeats the pattern n times
|
// !rep(pattern, count) repeats the pattern n times
|
||||||
// Inserting !any between each repetition
|
// Inserting !any between each repetition
|
||||||
|
|||||||
Reference in New Issue
Block a user