Stone.js API
    Preparing search index...
    • Builds a regular expression for matching domains based on route options.

      Parameters

      • options: RegexPatternOptions

        The route options to build the regex from.

      • flags: string = 'i'

        Regular expression flags, defaults to 'i' (case insensitive).

      Returns RegExp

      A regular expression for matching domains or undefined if no domain is specified.

      const regex = domainRegex({ domain: '{subdomain}.example.com' });
      console.log(regex?.test('api.example.com')); // true