RE Question

Victor Subervi victorsubervi at
Sun Aug 2 23:22:20 CEST 2009

How do I search and replace something like this:
aLine = re.sub('[<]?[p]?[>]?<font size="h' + str(x) + '"[
a-zA-Z0-9"\'=:]*>[<]?[b]?[>]?', '<h' + str(x) + '>', aLine)
where RE *only* looks for the possibility of "<p>" at the beginning of the
string; that is, not the individual components as I have it coded above, but
the entire 3-character block?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list