Function between

Returns source text that is between start and end match strings. Returns undefined if start/end is not found.

// Yields ` orange `;
between(`apple orange melon`, `apple`, `melon`);
  • Parameters

    • source: string

      Source text

    • start: string

      Start match

    • Optionalend: string

      If undefined, the start string will be looked for

    • lastEndMatch: boolean = true

      If true, looks for the last match of end (default). If false, looks for the first match.

    Returns undefined | string