Регулярное выражение Python - почему конец строки ($ и \ Z) не работает с выражениями группы?

В Python 2.6. кажется, что маркеры конца строки$ а также\Z не совместимы с групповыми выражениями. Например

import re
re.findall("\w+[\s$]", "green pears")

возвращается

['green ']

(так$ эффективно не работает). И используя

re.findall("\w+[\s\Z]", "green pears")

приводит к ошибке:

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/re.pyc in findall(pattern, string, flags)
    175 
    176     Empty matches are included in the result."""
--> 177     return _compile(pattern, flags).findall(string)
    178 
    179 if sys.hexversion >= 0x02020000:

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/re.pyc in _compile(*key)
    243         p = sre_compile.compile(pattern, flags)
    244     except error, v:
--> 245         raise error, v # invalid expression
    246     if len(_cache) >= _MAXCACHE:
    247         _cache.clear()

error: internal: unsupported set operator

Why does it work that way and how to go around?

Ответы на вопрос(3)

Ваш ответ на вопрос