@jiminp/tooltool
    Preparing search index...

    Function substringBetween

    • Returns the substring between the first start and the first end that follows it.

      Type Parameters

      • T extends string | null = null

      Parameters

      • s: Nullish

        String (or null/undefined) to find the substring of.

      • start: string | RegExp

        Needle that marks where the cropped string should start.

      • end: string | RegExp

        Needle that marks where the cropped string should end.

      • Optionalon_missing: T

        Value to return when s is nullish or delimiters are not found (defaults to null).

      Returns T

      • The substring between the first occurrence of start and the subsequent first occurrence of end.
      • on_missing if s is null/undefined or if the delimiters cannot be found in order.

      The search for end begins after the first start is found. Any occurrence of end before the first start is ignored.

      substringBetween("<a>b</a>", "<a>", "</a>");       // "b"
      substringBetween("<a><b></a>", "<a>", "</a>"); // "<b>"
      substringBetween("yabbadabbadoo", "abba", "doo"); // "dabba"
      substringBetween("a1b2a", "b", "a"); // "2"
      substringBetween("<a>b", "<a>", "</a>"); // null
      substringBetween("ab</a>", "<a>", "</a>"); // null
      substringBetween(undefined, "<a>", "</a>"); // null
      substringBetween("<a>b</a>", "<c>", "</c>", ""); // ""
    • Returns the substring between the first start and the first end that follows it.

      Type Parameters

      • T extends string | null = null

      Parameters

      • s: Nullable<string>

        String (or null/undefined) to find the substring of.

      • start: string | RegExp

        Needle that marks where the cropped string should start.

      • end: string | RegExp

        Needle that marks where the cropped string should end.

      • Optionalon_missing: T

        Value to return when s is nullish or delimiters are not found (defaults to null).

      Returns string | T

      • The substring between the first occurrence of start and the subsequent first occurrence of end.
      • on_missing if s is null/undefined or if the delimiters cannot be found in order.

      The search for end begins after the first start is found. Any occurrence of end before the first start is ignored.

      substringBetween("<a>b</a>", "<a>", "</a>");       // "b"
      substringBetween("<a><b></a>", "<a>", "</a>"); // "<b>"
      substringBetween("yabbadabbadoo", "abba", "doo"); // "dabba"
      substringBetween("a1b2a", "b", "a"); // "2"
      substringBetween("<a>b", "<a>", "</a>"); // null
      substringBetween("ab</a>", "<a>", "</a>"); // null
      substringBetween(undefined, "<a>", "</a>"); // null
      substringBetween("<a>b</a>", "<c>", "</c>", ""); // ""