how to remove <BR> using replace function?
Sion Arrowsmith
siona at chiark.greenend.org.uk
Thu Feb 9 07:59:19 EST 2006
Duncan Booth <duncan.booth at suttoncourtenay.org.uk> wrote:
>Although I generally advise against overuse of regular expressions, this is
>one situation where regular expressions might be useful: [ ... ]
>>>> nobr = re.compile('\W*<br.*?>\W*', re.I)
Agreed (on both counts), but r'\s*<br.*?>\s*' might be better
(consider what happens with "an unfortunate... <br> in the middle"
if you use \W rather than \s).
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list