matches against list of regexp and returns first match
(string, *args)
| 6 | from urlparse import urlparse |
| 7 | |
| 8 | def 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 | |
| 20 | def parseNames(files): |