Function addRegExpFlags

  • Creates a new RegExp by adding the given flags to the original RegExp.

    Parameters

    • originalRegExpOrString: string | RegExp
    • flags: string

    Returns RegExp

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

    addRegExpFlags(/a/i, 'gm');
    // output is `/a/igm`