Answer the question
In order to leave comments, you need to log in
How to remove spaces in closing tags?
I'm using google translator api in node.js. And after a line break, the result is the following -<p>Hello, my name is <strong>Igor</strong></p>
<p> Здравствуйте, меня зовут <strong> Игорь </ strong> </ p>
Spaces appear in the closing tags, which makes the html invalid. Also, unwanted spaces appear between the word and the tag. How to remove those unnecessary spaces?
Answer the question
In order to leave comments, you need to log in
No regulars. Just
If suddenly there are several spaces, which is unlikely, then reg
$s = preg_replace('/<\/(\s+)(\w/)/gs', '</$2', $s);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question