B
B
Bestolkovy2016-09-27 10:59:12
PHP
Bestolkovy, 2016-09-27 10:59:12

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

1 answer(s)
D
Dmitry Dart, 2016-09-27
@gobananas

Different variants:
preg_replace('/<\/pre>\n\n/ism', "</pre><br>")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question