• Given a regular expression and a string, returns true if the string matches the regular expression.

    Example

    const matchNumbers = match(/\d+/u);

    matchNumbers("123"); // true
    matchNumbers("abc"); // false

    Parameters

    • regularExpression: {
          dotAll: boolean;
          flags: string;
          global: boolean;
          ignoreCase: boolean;
          lastIndex: number;
          multiline: boolean;
          source: string;
          sticky: boolean;
          unicode: boolean;
          [matchAll](str) => IterableIterator<RegExpMatchArray>;
          [match](string) => null | RegExpMatchArray;
          [replace](string, replaceValue) => string;
          [replace](string, replacer) => string;
          [search](string) => number;
          [split](string, limit?) => string[];
          compile(pattern, flags?) => RegExp;
          exec(string) => null | RegExpExecArray;
          test(string) => boolean;
      } | `/${string}/u` | `/${string}/su` | `/${string}/mu` | `/${string}/msu` | `/${string}/iu` | `/${string}/isu` | `/${string}/imu` | `/${string}/imsu` | `/${string}/gu` | `/${string}/gsu` | `/${string}/gmu` | `/${string}/gmsu` | `/${string}/giu` | `/${string}/gisu` | `/${string}/gimu` | `/${string}/gimsu`

      Instance of RegExp or a string.

    Returns ((text) => boolean)

    true if the string matches the regular expression, false otherwise.

      • (text): boolean
      • Parameters

        • text: string

        Returns boolean