i am getting the following HTML from a textbox in laravel:
<p>Just a test</p>
<p> </p>
<p>Just a test</p>
<p> </p>
<p>Just a test</p>
Basically what i want to do is just remove all the
and also all the <p> </p>
, i am aware that using regex's to filter HTML is a bad idea , but in my case the scenario is limited to just there 2 options i mentioned above.
So i have the below PHP code:
$replaceNbsp = array(' ' , ' ' , '<p> </p>' );
$blog_content = str_replace($replaceNbsp , ' ' , $request->blog_content);
return $blog_content;
But now intsead of removing the <p> </p>
completely , i get the below output.
<p>Just a test</p>
<p> ;</p>
<p>Just a test</p>
<p> ;</p>
<p>Just a test</p>
How do i replace the HTML in the description too ??