from bs4 import BeautifulSoup
html = BeautifulSoup('<html><head></head><body><a href="/track?no=ABCD0000000">ABCD0000000<br /></a></body></html>')
html.find_all('a', text=re.compile('ABCD0000000', re.IGNORECASE))
html.find('br').replaceWith('\n')
html.find_all('a', text=re.compile('ABCD0000000', re.IGNORECASE))html.find('br').replaceWith('')
html.find_all('a', text=re.compile('ABCD0000000', re.IGNORECASE))
The same result.. html = BeautifulSoup('<html><head></head><body><a href="/track?no=ABCD0000000">ABCD0000000</a></body></html>')
html.find_all('a', text=re.compile('ABCD0000000', re.IGNORECASE))
[<a href="/track?no=ABCD0000000">ABCD0000000</a>]
- Works fine.
Is this a bug or do I misunderstand something?import re
re.sub(re.compile('<br\s*/>', re.IGNORECASE), '\n', '<html><head></head><body><a href="/track?no=ABCD0000000">ABCD0000000<br /></a></body></html>')--
You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beautifulsou...@googlegroups.com.
To post to this group, send email to beauti...@googlegroups.com.
Visit this group at http://groups.google.com/group/beautifulsoup.
For more options, visit https://groups.google.com/d/optout.