HtmlPurifier: Remove Ambiguous WhiteSpace?

1k views Asked by At

Is it possible to remove ambiguous whitespace from a string containing html with HTMLPurifier? I wasn't able to find anything relevant in the documentation. I'm also open to other methods if they exist.

Example Input:

    Test Line1
<p>
    Test Line2</p>
<p>
    Line 3</p>

Optimal Output:

Test Line1<p>Test Line2</p><p>Line 3</p>

Thanks!!!!!!

1

There are 1 answers

3
Lari13 On BEST ANSWER

Can regular expression help?

$text = preg_replace('/\s+/u', '', $text)