Correctly handle (?i) in ignores (fixes #1953)
This commit is contained in:
@@ -38,14 +38,6 @@ func Convert(pattern string, flags int) (*regexp.Regexp, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Support case insensitive ignores. We do the loop because we may in some
|
||||
// circumstances end up with multiple insensitivity prefixes
|
||||
// ("(?i)(?i)foo"), which should be accepted.
|
||||
for ignore := strings.TrimPrefix(pattern, "(?i)"); ignore != pattern; ignore = strings.TrimPrefix(pattern, "(?i)") {
|
||||
flags |= CaseFold
|
||||
pattern = ignore
|
||||
}
|
||||
|
||||
if flags&NoEscape != 0 {
|
||||
pattern = strings.Replace(pattern, "\\", "\\\\", -1)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user