jonathanlarsen/node-otter-routes · file.js
javascript logo
function (method) {
            var regex = new RegExp('^' + method, 'i');
            var m = controllerName.match(regex);
            if (m) {
                match = m[0].toLowerCase();
                return true;
            }
            return false;
        }
Similar code snippets
1.
0xdec/draft.js · length.js
Match rating: 59.96% · See similar code snippets
javascript logo
function(val, regex) {
  // TODO: strict match anchor (^ instead of word end)
  regex = new RegExp(`${regex}$`, 'i');
  val = regex.exec(val);
  return val ? val[0].toLowerCase() : false;
}
2.
glayzzle/php-core · datetime.js
Match rating: 59.28% · See similar code snippets
javascript logo
function (j, regex, cb) {
        if (typeof regex === 'string') {
          regex = new RegExp('^' + regex, 'i')
        }
        var check = dateStr.slice(j)
        var match = regex.exec(check)
        // Even if the callback returns null after assigning to the
        // return object, the object won't be saved anyways
        var testNull = match ? cb.apply(null, match) : null
        if (testNull === null) {
          throw new Error('No match in string')
        }
        return j + match[0].length
      }
3.
ionic-team/ng-cordova · ionic.bundle.js
Match rating: 53.65% · See similar code snippets
javascript logo
function(regex) {
        if (isString(regex) && regex.length > 0) {
          regex = new RegExp('^' + regex + '$');
        }

        if (regex && !regex.test) {
          throw minErr('ngPattern')('noregexp',
            'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
            regex, startingTag(elm));
        }

        regexp = regex || undefined;
        ctrl.$validate();
      }
4.
bbusschots-mu/mu-qunit-util · index.es.js
Match rating: 52.61% · See similar code snippets
javascript logo
function regexpCheck(regexp, regexes) {
        is[regexp] = function(value) {
            return regexes[regexp].test(value);
        };
    }
5.
GoIncremental/gi-util · gi-util.js
Match rating: 52.51% · See similar code snippets
javascript logo
function test(string, regex) {
        if (typeof regex === 'string' || regex instanceof String) {
            regex=new RegExp(regex);
        }

        if (regex instanceof RegExp) {
            return regex.test(string);
        }
        else if (regex && Array.isArray(regex.and)) {
            return regex.and.every(function (item) {
                return test(string, item);
            });
        }
        else if (regex && Array.isArray(regex.or)) {
            return regex.or.some(function (item) {
                return test(string, item);
            });
        }
        else if (regex && regex.not) {
            return !test(string, regex.not);
        }
        else {
            return false;
        }
    }
6.
pmh/elf · rule.js
Match rating: 52.08% · See similar code snippets
javascript logo
function (source) {
    var match;
    if (typeof this.regex === "string") {
     match = true;
     for (var i = 0; i < this.regex.length; i++)
       if (source[i] !== this.regex[i]) match = false;
     return match ? source.substring(0, this.regex.length) : '';
    }

    match = source.match(this.regex)//.shift() : '';
    return match ? match.shift() : '';
  }
7.
hubot-scripts/hubot-business-cat · scripts.js
Match rating: 52.03% · See similar code snippets
javascript logo
function(re) {
      regex = (new RegExp(re));
      if (str.match(regex) !== null) {
        arr.push(str.match(regex)[0]);
      }
    }
8.
opal/opal-node · strscan.js
Match rating: 52.01% · See similar code snippets
javascript logo
function(regex) {
      var self = this;

      
      var regexp = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)),
          result = regexp.exec(self.working);

      if (result == null) {
        return self.matched = nil;
      }

      return self.matched = result[0];
    ;
    }
9.
Picolab/pico-engine · index.js
Match rating: 51.62% · See similar code snippets
javascript logo
function (ctx, val, regex) {
  if (!types.isRegExp(regex)) {
    regex = new RegExp(types.toString(regex))
  }
  return regex.test(types.toString(val))
}
10.
aleclarson/match-any · index.js
Match rating: 51.57% · See similar code snippets
javascript logo
function matchAny(input) {
  let match = null
  const matches = []
  for (let i = 1; i < arguments.length; i++) {
    const regex = arguments[i]
    if (!regex.global) {
      throw Error('RegExp instance must be marked as global')
    }
    while (match = regex.exec(input)) {
      match.input = undefined
      match.regex = regex
      matches[match.index] = match
    }
  }
  return matches
}