Sion Arrowsmith wrote: > Duncan Booth <[EMAIL PROTECTED]> 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). >
Yes, I don't really know why I wrote \W when I obviously meant \s. Thanks for correcting that. Even better might be r'(\s*<br.*?>)+\s*' to get multiple runs of <br> tags. -- http://mail.python.org/mailman/listinfo/python-list