开发者

Using preg_replace in php for whitespace between <br/> and <p> tags

I need to remove this string if found in my string:

<p><br/>   </p>

Cant replace this:

<p开发者_运维问答><br/>Test.   </p>

The whitespace expression I am using wasn't working for that, thank you for your help!


Here you go:

preg_replace('!<br/>\s+</p>!', '<br/></p>', $variable_name);


Try this:

preg_replace('%<p><br/>\s*</p>%', '', $string);

But what do you mean with Cant replace this ? Should this line also be replaced or not or how?

Update:
To clarify: Do you want to have only whitespaces removed or the whole <p><br/> </p> ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜