Skip to content

Commit 839ced4

Browse files
authored
Merge pull request #73 from github/fix-pathological-regex
Fix pathological backtracking in signature regexp
2 parents 7ef96a4 + 94797d3 commit 839ced4

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

lib/email_reply_parser.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,8 @@ def read(text)
132132

133133
private
134134
EMPTY = "".freeze
135-
SIGNATURE = '(?m)(--\s*$|__\s*$|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)'
136-
137-
begin
138-
require 're2'
139-
SIG_REGEX = RE2::Regexp.new(SIGNATURE)
140-
rescue LoadError
141-
SIG_REGEX = Regexp.new(SIGNATURE)
142-
end
135+
SIGNATURE = '(?m)(--\s*$|__\s*$|\w-$)|(^(\w+\s+){1,3}ym morf tneS$)'
136+
SIG_REGEX = Regexp.new(SIGNATURE)
143137

144138
### Line-by-Line Parsing
145139

0 commit comments

Comments
 (0)