Function replaceFirstIgnoreCase

  • Returns the string that replaced the first occurrence in the given text, case-insensitive

    Parameters

    • Optionaltext: null | string

      the text to inspect

    • Optionalsearch: null | string | RegExp

      the string or regex to match

    • Optionalreplace: null | string

      the expected replacement string

    Returns string | undefined | null

    the string that replaced the first occurrence in the given text, case-insensitive

    replaceFirstIgnoreCase(undefined, undefined, undefined);    // undefined
    replaceFirstIgnoreCase('foobar-foobar', 'foobar', undefined); // 'foobar-foobar'
    replaceFirstIgnoreCase('foobar-foobar', 'FOOBAR', 'hello'); // 'hello-foobar'