• Creates a regular expression that matches URLs containing the given baseUrl, or a subdomain of the given baseUrl. In case there is a subdomain, the first match of the regular expression will be that subdomain.

    Examples with baseUrl http://test.com/foo/:

    • Will match http://test.com/foo/
    • Will match http://test.com/foo/bar/baz
    • Will match http://alice.bob.test.com/foo/bar/baz, first match result will be alice.bob
    • Will not match http://test.com/
    • Will not match http://alicetest.com/foo/

    Parameters

    • baseUrl: string

      Base URL for the regular expression.

    Returns RegExp