Ticket #15093: 15093.diff

File 15093.diff, 855 bytes (added by ersame, 14 years ago)
  • django/utils/text.py

     
    212212# for single-quoted strings).
    213213smart_split_re = re.compile(r"""
    214214    ((?:
    215         [^\s'"]*
    216         (?:
    217             (?:"(?:[^"\\]|\\.)*" | '(?:[^'\\]|\\.)*')
    218             [^\s'"]*
    219         )+
    220     ) | \S+)
     215        "([^"\\]|\\.)*"  | '([^'\\]|\\.)*'
     216    ) | [^"'\s]+)
    221217""", re.VERBOSE)
    222218
    223219def smart_split(text):
     
    234230    [u'Another', u"'person\\'s'", u'test.']
    235231    >>> list(smart_split(r'A "\"funky\" style" test.'))
    236232    [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"']
    237235    """
    238236    text = force_unicode(text)
    239237    for bit in smart_split_re.finditer(text):
Back to Top