Commit 94797d3
committed
Fix pathological backtracking in signature regexp
This commit fixes the pathological backtracking in the regexp so that we
don't need the RE2 gem anymore.
The problem was the `(\w+\s*){1,3}` part. Since we accept 0 or more
spaces, and 1 to 3 times, the regex engine would keep backtracking to
figure out if it should do 1, 2, or 3 matches. We know we want at
least one match, and it *must* be followed by one or more spaces. If we
remove the space before the "y", we can eliminate the backtracking by
making at least one space required (as the original regular expression
indicated)1 parent 7ef96a4 commit 94797d3
1 file changed
Lines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 135 | + | |
| 136 | + | |
143 | 137 | | |
144 | 138 | | |
145 | 139 | | |
| |||
0 commit comments