Function setRegExpCaseSensitivity

  • Creates a new RegExp by adding or removing the case insensitivity flag 'i', based on the given caseSensitive input. The first input can also be a string and it will be converted into a RegExp.

    Parameters

    • originalRegExpOrString: string | RegExp
    • __namedParameters: { caseSensitive: boolean }

    Returns RegExp

    import {setRegExpCaseSensitivity} from '@augment-vir/common';

    setRegExpCaseSensitivity(/abc/i, {caseSensitive: true}); // output is `/abc/`
    setRegExpCaseSensitivity(/abc/, {caseSensitive: false}); // output is `/abc/i`
    setRegExpCaseSensitivity('abc', {caseSensitive: true}); // output is `/abc/i`