Help needed: cryptic perl regular expression in python syntax

Ville Vainio ville at
Tue Oct 19 14:45:01 CEST 2004

>>>>> "pekka" == pekka niiranen <pekka.niiranen at> writes:

    pekka> Which is fine, but is there a way to join 3 raw strings
    pekka> together into another raw strings? like:

    pekka> r1 = r'''(^\s*)(s|tr)(.)(\\?\??'''
    pekka> r2 = r'''\\?\??)\3(.*?)\3(.*)'''
    pekka> p1 = r1 + key + r2 # p1 should remain raw string too

The term "raw string" only has significance with string literals -
every string object is a "raw string". Backslashes are only
interpreted when converting string literals to in-memory string

Ville Vainio

More information about the Python-list mailing list