Answer the question
In order to leave comments, you need to log in
How to find empty lines around a container?
Good afternoon!
Can you please tell me how to find the empty lines around the <pre> ... </pre> container and replace them with the <br> tag?
EXAMPLE: Before
:
Lorem Ipsum
Lorem Ipsum
Lorem Ipsum
<pre> Lorem Ipsum
Lorem Ipsum
Lorem Ipsum </pre>
Lorem Ipsum
Now:
Lorem Ipsum
<br>
Lorem Ipsum
<br>
Lorem Ipsum
<br>
<pre> Lorem Ipsum
Lorem Ipsum
Lorem Ipsum </pre>
<br>
Lorem Ipsum
Answer the question
In order to leave comments, you need to log in
Different variants:preg_replace('/<\/pre>\n\n/ism', "</pre><br>")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question