Help needed: cryptic perl regular expression in python syntax

Ville Vainio ville at spammers.com
Tue Oct 19 08:45:01 EDT 2004


>>>>> "pekka" == pekka niiranen <pekka.niiranen at wlanmail.com> 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
objects.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list