|                         # ---- Double Quote Text ----
|    "                    # match a double quote
|    (                    #  - Two Possiblities:
|        \\.              # match two backslashes followed by anything
(include newline)
|        |                #         OR
|        [^"]             # do not match a single quote
|    )*                   #  - from zero to many
|    "                    # finally match a double quote
|
|    |                    # ======== OR ========
|
|                         # ---- Single Quote Text ----
|    '                    # match a single quote
|    (                    #  - Two Possiblities:
|        \\.              # match two backslashes followed by anything
(include newline)
|        |                #         OR
|        [^']             # do not match a single quote
|    )*                   #  - from zero to many
|    '                    # finally match a single quote
|    """, DOTALL|VERBOSE)

Used this before (minus those | at the beginning) to find double
quotes and single quotes in a file (there is more to this that looks
for C++ and C style quotes but that isn't needed here), perhaps you
can take it another step to not do changes to these matches?

r""""(\\.|[^"])*"|'(\\.|[^'])*'""", DOTALL)

is it in a single line :)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to