Function urlRoutePattern

  • Parses URL route pattern.

    Pattern format:

    • Empty string corresponds to empty pattern.

    • / matches directory separator. Corresponds to rmatchDirSep.

    • * matches a part of route entry name. Corresponds to rmatchAny or rmatchEntry.

    • {capture} captures a part of entry name as capture. Corresponds to rcaptureAny or rcaptureEntry.

    • /** matches any number of directories. Corresponds to rmatchDirs

    • /{capture:**} captures any number of directories as capture. Corresponds to rcaptureDirs.

    • {(regexp)flags} matches a part of entry name matching the given regular expression with optional flags. Corresponds to rcaptureRegExp.

    • {capture(regexp)flags} captures a part of entry name matching the regular expression with optional flags. Corresponds to rcaptureRegExp.

    • ?name requires URL search parameter to present. Corresponds to rmatchSearchParam('name').

    • ?name=value requires URL search parameter to have the given value. Corresponds to rmatchSearchParam('name', 'value').

    • Everything else matches verbatim and corresponds to rmatchString or rmatchName.

    The pattern parts are URL-decoded after parsing. So the pattern string may contain URL-encoded reserved and special characters.

    Parameters

    • pattern: string

      Pattern string.

    Returns RoutePattern<URLRoute>

    Simple route pattern.

Generated using TypeDoc