O
O
Optimus2015-11-04 00:11:00
PHP
Optimus, 2015-11-04 00:11:00

Need help with php regex?

Task:
Select lines where between the opening <h1> and the opening <p> there is no closing /h1, divide the entire line into groups (for subsequent replacement).

// Нужно
<h1> Наши <b>основные</b> тезисы <p>

// Не нужно
<h1> Наши <b>основные</b> </h1>тезисы <p>

I tried but I can’t figure out regexr.com/3c4ar actually I need a range but inside of which not individual characters / h1 are excluded, namely their sequence / h1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-11-04
Pyan @marrk2

It is not necessary to parse html with regulars, and everything will be much easier. There are SimpleXML and other DOM APIs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question