Reputation: 6729
I want to remove every <td>
containing an specific domain but i wonder why the regex is not working
$html = preg_replace("@<td align=\"center\">(.*?)liversely(.*?)<\\/a><\\/td>@s", "", $html);
Here is how the html look like
<td align="center"><a href="http://liversely.com/lock?q=something" rel="nofollow"><img src="http://otherdomain.com/images/dlbutton10.png"></a></td>
I want to remove every instance of code shown above
Upvotes: 0
Views: 97
Reputation: 174696
This <\\/a>
regex pattern present within the @
delimiters would match <
then a \
symbol, then a forward slash symbol /
then a>
. But there isn't a closing tag like this . So your pattern failed to match.
Changing your pattern like below will match the input string.
@<td align=\"center\">(.*?)liversely(.*?)</a></td>@s
Upvotes: 1