index.d.ts 589 B

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