We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16ba6c7 commit 6700c3eCopy full SHA for 6700c3e
docs/engineering/javascript/snippets/match-all.md
@@ -15,7 +15,10 @@ const getUniqueMatches = (str, regex) => {
15
const array = [...str.matchAll(regex)]
16
const finalSet = new Set()
17
array.forEach(it => finalSet.add(it[1]))
18
- console.log([...finalSet].join('\n'))
+ const matchesAsArray = [...finalSet]
19
+ console.log(matchesAsArray.join('\n'))
20
+ console.log(`Found ${finalSet.size} matches`)
21
+ return matchesAsArray
22
}
23
24
getUniqueMatches(str, /etc(\/[a-z\-]+\/[a-z\-]+\/[a-z\-]+\/)/g)
0 commit comments