Function betweenChomp

Like between, but also returns the source string without the start/end match and what's between.

const [src,between] = betweenChomp('hello [there] friend', '[', ']');
// src: 'hello friend'
// between: 'there'
  • Parameters

    • source: string
    • start: string
    • Optionalend: string
    • lastEndMatch: boolean = true

    Returns [source: string, between: string]