Add a comment for the charclass limit.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
Cyril Tovena 2021-10-05 13:52:12 +02:00
parent c751cfbfce
commit 453cc5de75
No known key found for this signature in database
GPG key ID: FD8F768F9D633FB6

View file

@ -91,6 +91,9 @@ func findSetMatches(re *syntax.Regexp, base string) []string {
for i := 0; i < len(re.Rune); i = i + 2 {
totalSet += int(re.Rune[i+1] - re.Rune[i])
}
// limits the total characters that can be used to create matches.
// In some case like negation [^0-9] a lot of possibilities exists and that
// can create thousands of possible matches at which points we're better of using regexp.
if totalSet > 100 {
return nil
}