From 762430de06c88060960ca16f349b65808394552c Mon Sep 17 00:00:00 2001 From: Himanshu Chauhan Date: Sat, 9 Dec 2023 03:09:57 +0000 Subject: [PATCH] Change-other-example --- .../js-examples/regexp/regexp-groups-ranges.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/live-examples/js-examples/regexp/regexp-groups-ranges.js b/live-examples/js-examples/regexp/regexp-groups-ranges.js index f6be29a97..2259f46be 100644 --- a/live-examples/js-examples/regexp/regexp-groups-ranges.js +++ b/live-examples/js-examples/regexp/regexp-groups-ranges.js @@ -6,9 +6,8 @@ console.log(`Width: ${match[1]} / Height: ${match[2]}.`); // Expected output: "Width: 1440 / Height: 900." // Backreferences -const quote = `Single quote "'" and double quote '"'`; -const regexpQuotes = /(['"]).*?\1/g; -for (const match of quote.matchAll(regexpQuotes)) { - console.log(match[0]); -} -// Expected output: '"'"' '"'"' +const findDuplicates = 'foo foo bar'; +const regex = /\b(\w+)\s+\1\b/g; +console.log(findDuplicates.match(regex)); +// Expected output: Array ["foo", "foo"] +