- Notifications
You must be signed in to change notification settings - Fork20.6k
Commit39dae7f
committed
Deprecated: optimize regular expression for $.trim for long sequences of whitespace runs
Regex imp implementation takes O(N^2) time to trim the string when multipleadjacent spaces were present.The new expression require that the "whitespace run" starts from a non-whitespaceto avoid O(N^2) behavior when the engine would try matching "\s$" at each space position.1 parent410d5cf commit39dae7f
1 file changed
+4
-2
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 |
| |
20 | 22 |
| |
21 | 23 |
| |
| |||
82 | 84 |
| |
83 | 85 |
| |
84 | 86 |
| |
85 |
| - | |
| 87 | + | |
86 | 88 |
| |
87 | 89 |
|
0 commit comments
Comments
(0)