Show More
@@ -228,7 +228,21 b' def _patsplit(pattern, default):' | |||||
228 | return default, pattern |
|
228 | return default, pattern | |
229 |
|
229 | |||
230 | def _globre(pat): |
|
230 | def _globre(pat): | |
231 |
'''Convert an extended glob string to a regexp string. |
|
231 | r'''Convert an extended glob string to a regexp string. | |
|
232 | ||||
|
233 | >>> print _globre(r'?') | |||
|
234 | . | |||
|
235 | >>> print _globre(r'*') | |||
|
236 | [^/]* | |||
|
237 | >>> print _globre(r'**') | |||
|
238 | .* | |||
|
239 | >>> print _globre(r'[a*?!^][^b][!c]') | |||
|
240 | [a*?!^][\^b][^c] | |||
|
241 | >>> print _globre(r'{a,b}') | |||
|
242 | (?:a|b) | |||
|
243 | >>> print _globre(r'.\*\?') | |||
|
244 | \.\*\? | |||
|
245 | ''' | |||
232 | i, n = 0, len(pat) |
|
246 | i, n = 0, len(pat) | |
233 | res = '' |
|
247 | res = '' | |
234 | group = 0 |
|
248 | group = 0 |
General Comments 0
You need to be logged in to leave comments.
Login now