(regExp: RegExp): (self: string) => IterableIterator<RegExpMatchArray>Returns an iterator over all regular expression matches in the string using
native String.prototype.matchAll semantics.
Example (Iterating regular expression matches)
import { pipe, String } from "effect"
const matches = pipe("hello world", String.matchAll(/l/g))
console.log(
Array.from(matches, (match) => `${match[0]}@${match.index}`).join(", ")
) // "l@2, l@3, l@9"searching
Source effect/String.ts:7271 lines
export const const matchAll: (
regExp: RegExp
) => (
self: string
) => IterableIterator<RegExpMatchArray>
Returns an iterator over all regular expression matches in the string using
native String.prototype.matchAll semantics.
Example (Iterating regular expression matches)
import { pipe, String } from "effect"
const matches = pipe("hello world", String.matchAll(/l/g))
console.log(
Array.from(matches, (match) => `${match[0]}@${match.index}`).join(", ")
) // "l@2, l@3, l@9"
matchAll = (regExp: RegExpregExp: RegExp) => (self: stringself: string): interface IterableIterator<T, TReturn = any, TNext = any>Describes a user-defined
Iterator
that is also iterable.
IterableIterator<RegExpMatchArray> => self: stringself.String.matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>Matches a string with a regular expression, and returns an iterable of matches
containing the results of that search.
matchAll(regExp: RegExpregExp)