MCPcopy Index your code
hub / github.com/pyload/pyload / matchFirst

Function matchFirst

module/common/packagetools.py:8–17  ·  view source on GitHub ↗

matches against list of regexp and returns first match

(string, *args)

Source from the content-addressed store, hash-verified

6from urlparse import urlparse
7
8def matchFirst(string, *args):
9 """ matches against list of regexp and returns first match"""
10 for patternlist in args:
11 for pattern in patternlist:
12 r = pattern.search(string)
13 if r is not None:
14 name = r.group(1)
15 return name
16
17 return string
18
19
20def parseNames(files):

Callers 1

parseNamesFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected