chore(regex): simplify secretPrefix, suffix (#1620)

combined character ranges,
removed duplicates in same character range,
replaced \x060 with literal `
combined \s with \r\n
This commit is contained in:
Ben-grmbl authored and GitHub committed 2025-01-15 18:21:44 -06:00
1 parent cc71bb1e9a
commit a3f623cc69
2 files changed
+143 -144

No files matched your search

+3 -4
View File
@@ -19,17 +19,16 @@ const (
identifierCaseInsensitivePrefix = `[\w.-]{0,50}?(?i:`
identifierCaseInsensitiveSuffix = `)`
identifierPrefix = `[\w.-]{0,50}?(?:`
identifierSuffix = `)(?:[ \t\w.-]{0,20})(?:[\s|']|[\s|"]){0,3}`
identifierSuffix = `)(?:[ \t\w.-]{0,20})[\s'"|]{0,3}`
// commonly used assignment operators or function call
//language=regexp
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=|,)`
// boundaries for the secret
// \x60 = `
secretPrefixUnique = `\b(`
secretPrefix = `(?:'|\"|\s|=|\x60){0,5}(`
secretSuffix = `)(?:['|\"|\n|\r|\s|\x60|;]|$)`
secretPrefix = "[`" + `'"\s=]{0,5}(`
secretSuffix = ")(?:[`" + `'"\s;]|$)`
)
func GenerateSemiGenericRegex(identifiers []string, secretRegex string, isCaseInsensitive bool) *regexp.Regexp {
+140 -140
View File
File diff suppressed because it is too large. Load diff