Skip to content

Commit da9d344

Browse files
authored
Update article.md
typos
1 parent 706b1f2 commit da9d344

File tree

1 file changed

+3
-3
lines changed
  • 5-regular-expressions/15-regexp-infinite-backtracking-problem

1 file changed

+3
-3
lines changed

5-regular-expressions/15-regexp-infinite-backtracking-problem/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For server-side Javascript it may become a vulnerability, and it uses regular ex
1212

1313
So the problem is definitely worth to deal with.
1414

15-
## Introductin
15+
## Introduction
1616

1717
The 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

259259
The 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
280280
let fixedReg = new RegExp(`<\\w+(?=(${attrReg.source}*))\\1>`, 'g');

0 commit comments

Comments
 (0)