Mathias Bynens | 79e2cf0 | 2020-05-29 14:46:17 | [diff] [blame] | 1 | declare namespace execall { |
| 2 | interface Match { |
| 3 | match: string; |
| 4 | subMatches: string[]; |
| 5 | index: number; |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | Find multiple RegExp matches in a string. |
| 11 | |
| 12 | @param regexp - Regular expression to match against the `string`. |
| 13 | @returns The matches. |
| 14 | |
| 15 | @example |
| 16 | ``` |
| 17 | import execall = require('execall'); |
| 18 | |
| 19 | execall(/(\d+)/g, '$200 and $400'); |
| 20 | // [ |
| 21 | // { |
| 22 | // match: '200', |
| 23 | // subMatches: ['200'], |
| 24 | // index: 1 |
| 25 | // }, |
| 26 | // { |
| 27 | // match: '400', |
| 28 | // subMatches: ['400'], |
| 29 | // index: 10 |
| 30 | // } |
| 31 | // ] |
| 32 | ``` |
| 33 | */ |
| 34 | declare function execall(regexp: RegExp, string: string): execall.Match[]; |
| 35 | |
| 36 | export = execall; |