File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
5-regular-expressions/15-regexp-infinite-backtracking-problem Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ For server-side Javascript it may become a vulnerability, and it uses regular ex
1212
1313So the problem is definitely worth to deal with.
1414
15- ## Introductin
15+ ## Introduction
1616
1717The plan will be like this:
1818
@@ -254,7 +254,7 @@ Unfortunately, but both these features are not supported by JavaScript.
254254
255255### Lookahead to the rescue
256256
257- We can get forbid backtracking using lookahead.
257+ We can forbid backtracking using lookahead.
258258
259259The pattern to take as much repetitions as possible without backtracking is: ` pattern:(?=(a+))\1 ` .
260260
@@ -274,7 +274,7 @@ Let's fix the regexp for a tag with attributes from the beginning of the chapter
274274
275275``` js run
276276// regexp to search name=value
277- let reg = / (\s * \w + =(\w + | "[^ "] * ")\s * )/
277+ let attrReg = / (\s * \w + =(\w + | "[^ "] * ")\s * )/
278278
279279// use new RegExp to nicely insert its source into (?=(a+))\1
280280let fixedReg = new RegExp (` <\\ w+(?=(${ attrReg .source } *))\\ 1>` , ' g' );
You can’t perform that action at this time.
0 commit comments