Ticket #16362: django-regex-allow-lookahead-16362.patch

File django-regex-allow-lookahead-16362.patch, 1.5 KB (added by charles@…, 13 years ago)

Initial proposed patch

  • django/utils/regex_helper.py

     
    5151    (3) Select the first (essentially an arbitrary) element from any character
    5252        class. Select an arbitrary character for any unordered class (e.g. '.'
    5353        or '\w') in the pattern.
    54     (5) Ignore comments and any of the reg-exp flags that won't change
    55         what we construct ("iLmsu"). "(?x)" is an error, however.
    56     (6) Raise an error on all other non-capturing (?...) forms (e.g.
    57         look-ahead and look-behind matches) and any disjunctive ('|')
    58         constructs.
     54    (5) Ignore comments, look-ahead and look-behind assertions, and any of the
     55        reg-exp flags that won't change what we construct ("iLmsu"). "(?x)" is
     56        an error, however.
     57    (6) Raise an error on any disjunctive ('|') constructs.
    5958
    6059    Django's URLs for forward resolving are either all positional arguments or
    6160    all keyword arguments. That is assumed here, as well. Although reverse
     
    121120                    walk_to_end(ch, pattern_iter)
    122121                else:
    123122                    ch, escaped = pattern_iter.next()
    124                     if ch in "iLmsu#":
     123                    if ch in "iLmsu#!=<":
    125124                        # All of these are ignorable. Walk to the end of the
    126125                        # group.
    127126                        walk_to_end(ch, pattern_iter)
Back to Top