mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-25 22:00:41 -04:00
fix(curriculum): modify regex backreference example code (#59643)
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user