fix(curriculum): modify regex backreference example code (#59643)

This commit is contained in:
Supravisor 2025-04-10 03:44:24 +12:00 committed by GitHub
parent 41d6eeb5b3
commit 5a5e5de8a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
```