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
| // A scratchpad testing the differences between: | |
| // - `String.prototype.match` (with & without `g` flag) | |
| // - `RegExp.prototype.exec` (with & without `g` flag) | |
| const str = "A string\nWith 2 endlines\n"; | |
| (function () { | |
| console.info("==== String.prototype.match GLOBAL ===="); | |
| const re = /(\w)(?<NamedGroup1>\w)\n/g; | |
| // Returns an array containing **all** string segments matching the **whole regex** |
NewerOlder