Utility TypeScript @ 2.0.0-beta
    Preparing search index...

    Function escRegExp

    • Escapes a string for use in a regular expression.

      Parameters

      • str: string

        To convert.

      Returns string

      Escaped string.

      export function escRegExp( str: string ): string {
      return str.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
      }
      new RegExp( `^${ escRegExp( filePath ) }\\/.+`, 'g' );
      

      0.1.0