Created
July 3, 2022 18:45
-
-
Save batazo/cbda1a61d825c823eadd4d0addc56124 to your computer and use it in GitHub Desktop.
RegExp match indices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fruits ="Fruits:apples, oranges, pears"; | |
const regex = /(apples)/gd; | |
const matches = [...fruits.matchAll(regex)]; | |
console.log(matches[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment