help with regular expression
Jason Orendorff
jason at jorendorff.com
Sat Dec 8 13:36:29 EST 2001
> I am writing a program in which I need to search an arbitrary string
> and return the part between a certain opening sequence, and a closing
> sequence. [...] I want to be able to "escape" the ending
> sequence with either double quotes (">>") or single quotes ('>>').
r"""<<(('>>'|">>"|>(?!>)|[^>])*)>>"""
See http://www.python.org/doc/current/lib/re-syntax.html
for the meaning of (?!>).
--
Jason Orendorff
http://www.jorendorff.com/
More information about the Python-list
mailing list