@nevware21/ts-utils
    Preparing search index...

    Function makeGlobRegex

    • Create a simple glob style regular expression from the string value, converting '**', '*' and '?' characters. Unlike createFilenameRegex the '*' and '?' will NOT match folder seperator characters '/' and '\'. If the source string contains folder seperators both '/' and '\' are treated as synonomous Each wildcard match will be captured as it's own group. The supported matching values are

      • '**' Matches any characters zero or more times include folder seperators '/' or '\'
      • '*' Matches any characters zero or more times, except '/' or '\'
      • '?' Matches any single character once only, except '/' or '\'
      • '/' Matches either '/' or '\' character, not captured as a group
      • '\' Matches either '/' or '\' character, not captured as a group

      Parameters

      • value: string

        The string value to converted.

      • OptionalignoreCase: boolean

        Flag to indicate whether the regular expression should be case-sensitive, Defaults to false.

      • OptionalfullMatch: boolean

        Flag to identify whether the RegExp should be wrapped with '^' and '$' to incidate match the entire string only.

      Returns RegExp

      The new Regular Expression created from the provided value.

      0.9.0

      let regex = makeGlobRegex("src\\**\\*.ts");

      let matches = regex.exec("Hello");
      matches; // null

      let matches = regex.exec("Src/index.ts");
      matches; // null - Specify the ignoreCase if you want this to match

      let matches = regex.exec("src/index.ts");
      matches[0]; // "src/index.ts"
      matches[1]; // undefined;
      matches[2]; // "index"

      let matches = regex.exec("src\\index.ts");
      matches[0]; // "src\\index.ts"
      matches[1]; // undefined;
      matches[2]; // "index"

      let matches = regex.exec("src/helpers/regexp.ts");
      matches[0]; // "src/helpers/regexp.ts"
      matches[1]; // "helpers/"
      matches[2]; // "regexp"

      let matches = regex.exec("src\\helpers/regexp.ts");
      matches[0]; // "src\\helpers/regexp.ts"
      matches[1]; // "helpers/"
      matches[2]; // "regexp"

      let matches = regex.exec(" src/index.tsx ");
      matches[0]; // "src/index.ts"
      matches[1]; // undefined
      matches[2]; // "index"

      let matches = regex.exec(" src/helpers/regexp.ts. ");
      matches[0]; // "src/helpers/regexp.ts"
      matches[1]; // "helpers/"
      matches[2]; // "regexp"]);