x = '<td class="greymeta">Posted Date:<br/> </td>'
parse = BeautifulSoup(x,"lxml")
parse.find("td",text=re.compile(r"^Posted Date:")) # doesn't return anything
如果<br/>
代码中没有<td>
:
x = '<td class="greymeta">Posted Date: </td>'
parse.find("td",text=re.compile(r"^Posted Date:")) # returns output correcly