equal
deleted
inserted
replaced
528 except re.error: |
528 except re.error: |
529 # el is an invalid regex |
529 # el is an invalid regex |
530 return False |
530 return False |
531 |
531 |
532 def globmatch(el, l): |
532 def globmatch(el, l): |
533 # The only supported special characters are * and ?. Escaping is |
533 # The only supported special characters are * and ? plus / which also |
534 # supported. |
534 # matches \ on windows. Escaping of these caracters is supported. |
535 i, n = 0, len(el) |
535 i, n = 0, len(el) |
536 res = '' |
536 res = '' |
537 while i < n: |
537 while i < n: |
538 c = el[i] |
538 c = el[i] |
539 i += 1 |
539 i += 1 |
540 if c == '\\' and el[i] in '*?\\': |
540 if c == '\\' and el[i] in '*?\\/': |
541 res += el[i - 1:i + 1] |
541 res += el[i - 1:i + 1] |
542 i += 1 |
542 i += 1 |
543 elif c == '*': |
543 elif c == '*': |
544 res += '.*' |
544 res += '.*' |
545 elif c == '?': |
545 elif c == '?': |
546 res += '.' |
546 res += '.' |
|
547 elif c == '/' and os.name == 'nt': |
|
548 res += '[/\\\\]' |
547 else: |
549 else: |
548 res += re.escape(c) |
550 res += re.escape(c) |
549 return rematch(res, l) |
551 return rematch(res, l) |
550 |
552 |
551 def linematch(el, l): |
553 def linematch(el, l): |