mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(curriculum): modify regex backreference example code (#59643)
This commit is contained in:
parent
41d6eeb5b3
commit
5a5e5de8a7
@ -91,7 +91,7 @@ This current expression won't ensure that the number of `o` characters is the sa
|
||||
Inside a regular expression, a backreference is denoted with a backslash followed by the number of the capture group:
|
||||
|
||||
```js
|
||||
const regex = /free(co+de)camp.*free(co+de)camp/i;
|
||||
const regex = /free(co+de)camp.*free\1camp/i;
|
||||
console.log(regex.test("freecooooodecamp is great i love freecooooodecamp")); // true
|
||||
console.log(regex.test("freecooooodecamp is great i love freecodecamp")); // false
|
||||
```
|
||||
|
||||
Loading…
Reference in New Issue
Block a user