Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:

It looks like only the first 200 characters of the input string's repr are used 
as the compiled pattern's repr for some reason:

    https://github.com/python/cpython/blob/master/Modules/_sre.c#L1294

I don't know if there is a good reason, especially since this violates 
eval(repr(pattern)) == pattern in a bad way:

    >>> eval(repr(re.compile(STR_RE_URL)))
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "<string>", line 1
        
re.compile('(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\,
 re.IGNORECASE)
                                                                                
                                                                                
                                                                        ^
    SyntaxError: EOL while scanning string literal

----------
nosy: +Dennis Sweeney

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40879>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to