Last active
April 24, 2019 01:00
-
-
Save shisama/b558f90ceb7f6f489e466a494a4e4117 to your computer and use it in GitHub Desktop.
String#matchAll - New JavaScript Features in Node.js v12
This file contains 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 regexp = /t(e)(st(\d?))/g; | |
const str = 'test1test2'; | |
const array = [...str.matchAll(regexp)]; | |
console.log(array[0]) | |
// ['test1', 'e', 'st1', '1', index: 0, input: 'test1test2', groups: undefined] | |
console.log(array[1]) | |
// ['test2', 'e', 'st2', '2', index: 5, input: 'test1test2', groups: undefined] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment