Apply `pattern` on the current position and return
        the match object. (Doesn't touch pos). Use this for
        lookahead.
186332
def check(self, pattern):
        
        if self.eos:
            raise EndOfText()
        if pattern not in self._re_cache:
            self._re_cache[pattern] = re.compile(pattern, self.flags)
        return self._re_cache[pattern].match(self.data, self.pos)
1179418
def find_backwards(self, sub, in_current_line=False, ignore_case=False, count=1):
        
        if in_current_line:
            before_cursor = self.current_line_before_cursor[::-1]
        else:
            before_cursor = self.text_before_cursor[::-1]

        flags = re.IGNORECASE if ignore_case else 0
        iterator = re.finditer(re.escape(sub[::-1]), before_cursor, flags)

        try:
            for i, match in enumerate(iterator):
                if i + 1 == count:
                    return - match.start(0) - len(sub)
        except StopIteration:
            pass
1133568
def match1(pattern, data, **parse_kwargs):
    """"""
    matches = match(pattern, data, **parse_kwargs)
    return matches[0] if matches else None
578636
def find_all(self, pattern):
		
		pos = []
		last_found = -1
		while True:
			last_found = self.current_segment.data.find(pattern, last_found + 1)
			if last_found == -1:
				break
			pos.append(last_found + self.current_segment.start_address)
			
		return pos
1031223
function match(re) {
    var m = re.exec(css);
    if (!m) return;
    var str = m[0];
    updatePosition(str);
    css = css.slice(str.length);
    return m;
  }
1211518
def Pattern(*pattern)
      (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label)
      ::PatternMatching::PatternMatch.new(*pattern)
    end
882846
def scan(pattern, string, *args, **kwargs):
    
    return compile(pattern, *args, **kwargs).scan(string)
598125
def capture(self, pattern, name=None):
        

        if isinstance(pattern, basestring):
            pattern = re.compile(pattern)

        def munge(self, value):
            match = pattern.match(value)
            if not match:
                return NONE
            for group in [name or self.name, 1]:
                try:
                    return match.group(group)
                except IndexError:
                    pass
            return NONE

        return self.munge.attach(self)(munge)
1373801
def getmatch(self, regex, group=0, flags=0):
    

    match = self.match(regex, flags)
    if match:
      return match.group(group)
    return None
561082
def expect_re(self, regexp):
        
        prefix_len = self.match_prefix(
            self.prefix, self.next_line(require_prefix=False)
        )
        if prefix_len >= 0:
            match = self._expect_re(regexp, self.pos + prefix_len)
            self.match = match
            return match
        else:
            return None
506078
def match_main(self, text, pattern, loc):
    
    # Check for null inputs.
    if text == None or pattern == None:
      raise ValueError("Null inputs. (match_main)")

    loc = max(0, min(loc, len(text)))
    if text == pattern:
      # Shortcut (potentially not guaranteed by the algorithm)
      return 0
    elif not text:
      # Nothing to match.
      return -1
    elif text[loc:loc + len(pattern)] == pattern:
      # Perfect match at the perfect spot!  (Includes case of null pattern)
      return loc
    else:
      # Do a fuzzy compare.
      match = self.match_bitap(text, pattern, loc)
      return match
478166
def compare(self, origin, pattern):
        

        if origin is None or pattern is None:
            return False
        return re.match(pattern, origin) is not None
355396
def _fullmatch(pattern, text, *args, **kwargs):
    """"""
    match = re.match(pattern, text, *args, **kwargs)
    return match if match.group(0) == text else None
824357
def find_matching_bracket_position(self, start_pos=None, end_pos=None):
        

        # Look for a match.
        for A, B in '()', '[]', '{}', '<>':
            if self.current_char == A:
                return self.find_enclosing_bracket_right(A, B, end_pos=end_pos) or 0
            elif self.current_char == B:
                return self.find_enclosing_bracket_left(A, B, start_pos=start_pos) or 0

        return 0
256763
def has_match_at_current_position(self, sub):
        
        return self.text.find(sub, self.cursor_position) == self.cursor_position
4760
private void apply(HyphenationPattern pattern, int pos) {

    int internalOffset = pos - 2;
    HyphenationPatternPosition[] positions = pattern.getHyphenationPositions();
    for (HyphenationPatternPosition hyphenationPosition : positions) {
      int i = hyphenationPosition.index + internalOffset;
      if ((i >= 0) && (i < this.rankings.length) && (hyphenationPosition.ranking > this.rankings[i])) {
        this.rankings[i] = hyphenationPosition.ranking;
      }
    }
  }
529731
def match(pattern):
    
    regex = re.compile(pattern)

    def validate(value):
        if not regex.match(value):
            return e("{} does not match the pattern {}", value, pattern)
    return validate