Ticket #15093: 15093.diff
File 15093.diff, 855 bytes (added by , 14 years ago) |
---|
-
django/utils/text.py
212 212 # for single-quoted strings). 213 213 smart_split_re = re.compile(r""" 214 214 ((?: 215 [^\s'"]* 216 (?: 217 (?:"(?:[^"\\]|\\.)*" | '(?:[^'\\]|\\.)*') 218 [^\s'"]* 219 )+ 220 ) | \S+) 215 "([^"\\]|\\.)*" | '([^'\\]|\\.)*' 216 ) | [^"'\s]+) 221 217 """, re.VERBOSE) 222 218 223 219 def smart_split(text): … … 234 230 [u'Another', u"'person\\'s'", u'test.'] 235 231 >>> list(smart_split(r'A "\"funky\" style" test.')) 236 232 [u'A', u'"\\"funky\\" style"', u'test.'] 233 >>> list(smart_split(r' now "j "n" Y"')) 234 [u'now', u'"j "', u'n', u'" Y"'] 237 235 """ 238 236 text = force_unicode(text) 239 237 for bit in smart_split_re.finditer(text):