Created
June 13, 2020 10:19
-
-
Save nitayneeman/5520d633ed89a87617c092d5751a0c03 to your computer and use it in GitHub Desktop.
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 regex = /t(e)(st(\d?))/g; | |
const str = 'test1test2'; | |
// Using spread operator | |
const array = [...str.matchAll(regex)]; | |
// Using `from` method | |
const array2 = Array.from(str.matchAll(regex)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment