• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(10819)  |  Call(10671)  |  Derive(0)  |  Import(148)
Try to apply the pattern at the start of the string, returning
a match object, or None if no match was found.

        def match(pattern, string, flags=0):
    """Try to apply the pattern at the start of the string, returning
    a match object, or None if no match was found."""
    return _compile(pattern, flags).match(string)
        


src/p/y/pyjamas-0.7/examples/libtest/ReModuleTest.py   Pyjamas(Download)
        self.matchTest('test 6a', 'A(b).(c)d', re.I | re.S, 'ab\ncd', ['ab\ncd', 'b', 'c'], (0,5))
        self.matchTest('test 6b', '(?is)A(b).(c)d', 0, 'ab\ncd', ['ab\ncd', 'b', 'c'], (0,5))
 
        m = re.match("1..4", "1234")
        self.assertFalse(m is None, """re.match("1..4", "1234")""")
 
    def testSearchBasics(self):

src/n/l/nltk-HEAD/nltk/examples/school/categories.py   nltk(Download)
def process(pattern):
    new = []
    for term in pattern.split():
        if re.match('[A-Z]+$', term):
            new.append(BOUNDARY + WORD_OR_TAG + '/' + term + BOUNDARY)
        elif '/' in term:
            new.append(BOUNDARY + term + BOUNDARY)

src/g/e/gevent-0.13.1/greentest/test__examples.py   gevent(Download)
        def test(self):
            self.assertEqual(self.process.poll(), 1)
            stderr = self.process.stderr.read().strip()
            m = re.match('Traceback \(most recent call last\):.*?ImportError: .*?ssl.*', stderr, re.DOTALL)
            assert m is not None, repr(stderr)
 
        def tearDown(self):

src/c/l/clearversion-HEAD/trunk/clearVersion/etc/subversion/hooks/examples/mailer.py   clearversion(Download)
  def _get_final_list(self, props, propsel, ignore_props):
    list=[ ]
    if not props or not propsel:
      return list
    for prop, src_val, dst_val in props:
      if ignore_props and re.match(ignore_props, prop):
        continue
  def _get_diff(self, path, rev, date, base_path, base_rev, base_date,
                props, ignore_propdiffs, action_type):
    content = ''
    count = 0
    for prop, src_val, dst_val in props:
      if ignore_propdiffs and re.match(ignore_propdiffs, prop):
        continue
    self._default_params = self._global_params
 
    try:
      match = re.match(self.defaults.for_repos, repos_dir)
      if match:
        self._default_params = self._default_params.copy()
        self._default_params.update(match.groupdict())
      sub = getattr(self, group)
      params = self._default_params
      if hasattr(sub, 'for_repos'):
        match = re.match(sub.for_repos, repos_dir)
        if not match:
          continue
        params = params.copy()

src/c/l/clearversion-HEAD/clearVersion/etc/subversion/hooks/examples/mailer.py   clearversion(Download)
  def _get_final_list(self, props, propsel, ignore_props):
    list=[ ]
    if not props or not propsel:
      return list
    for prop, src_val, dst_val in props:
      if ignore_props and re.match(ignore_props, prop):
        continue
  def _get_diff(self, path, rev, date, base_path, base_rev, base_date,
                props, ignore_propdiffs, action_type):
    content = ''
    count = 0
    for prop, src_val, dst_val in props:
      if ignore_propdiffs and re.match(ignore_propdiffs, prop):
        continue
    self._default_params = self._global_params
 
    try:
      match = re.match(self.defaults.for_repos, repos_dir)
      if match:
        self._default_params = self._default_params.copy()
        self._default_params.update(match.groupdict())
      sub = getattr(self, group)
      params = self._default_params
      if hasattr(sub, 'for_repos'):
        match = re.match(sub.for_repos, repos_dir)
        if not match:
          continue
        params = params.copy()

src/j/a/java-balivernes-HEAD/RNpicker/src/ctbto/sandbox/template-example.py   java-balivernes(Download)
 
    print "group index %s"%(compiled.groupindex)
 
    aResult = re.match("(?P<year>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*Y|(?P<month>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*M|(?P<day>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*D|(?P<hour>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*H|(?P<minute>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*M|(?P<second>[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)(\s)*S",ex)
 
    value = aResult.group('hour')
 

src/s/h/shedskin-HEAD/examples/mm/mastermind.py   shedskin(Download)
def main():
    m = Mastermind()
    guesses = 8
    if len(sys.argv) > 1 and re.match("\d", sys.argv[1]) is not None:
        guesses = int(sys.argv[1])
    m.play(guesses)
 

src/b/r/braintree_python_examples-HEAD/tr_checkout_app_engine/braintree/resource.py   braintree_python_examples(Download)
    def __remove_wildcard_keys(allowed_keys, invalid_keys):
        wildcard_keys = [re.sub("\\[__any_key__\\]\Z", "", key) for key in allowed_keys if re.search("\\[__any_key__\\]", key)]
        new_keys = []
        for key in invalid_keys:
            if len([match for match in wildcard_keys if re.match(match, key)]) == 0:
                new_keys.append(key)
        return new_keys

src/s/k/skype4py-HEAD/examples/SkypeBot.py   skype4py(Download)
  def MessageStatus(self, msg, status):
    if status == Skype4Py.cmsReceived:
      if msg.Chat.Type in (Skype4Py.chatTypeDialog, Skype4Py.chatTypeLegacyDialog):
        for regexp, target in self.commands.items():
          match = re.match(regexp, msg.Body, re.IGNORECASE)
          if match:
            msg.MarkAsSeen()

src/e/c/ecell-HEAD/ecell4/trunk/doc/sample/ga/ga.py   ecell(Download)
		for aParameter in aParameterList:
			# example.
			# Process:/E:KmS 0.1 10.0 float
			aMatch = re.match('(\S+)\s+(\S+)\s+(\S+)\s+(\S+)',aParameter)
			if aMatch == None:
				aNGNumber += 1
			else:

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next