Correct syntax for pathological re.search()

Alan Bawden alan at csail.mit.edu
Tue Oct 8 16:59:48 EDT 2024


Karsten Hilbert <Karsten.Hilbert at gmx.net> writes:

           Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
           Type "help", "copyright", "credits" or "license" for more information.
           >>> tex = '\sout{'
           >>> tex
           '\\sout{'
           >>>

   Am I missing something ?

You're missing the warning it generates:

        > python -E -Wonce
        Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
        Type "help", "copyright", "credits" or "license" for more information.
        >>> tex = '\sout{'
        <stdin>:1: DeprecationWarning: invalid escape sequence '\s'
        >>> 


More information about the Python-list mailing list