##// END OF EJS Templates
match: _globre doctests
Mads Kiilerich -
r21112:03782d2f default
parent child Browse files
Show More
@@ -228,7 +228,21 b' def _patsplit(pattern, default):'
228 228 return default, pattern
229 229
230 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 246 i, n = 0, len(pat)
233 247 res = ''
234 248 group = 0
General Comments 0
You need to be logged in to leave comments. Login now