T
T
TechNOIR2017-09-28 13:11:59
Parsing
TechNOIR, 2017-09-28 13:11:59

How to choose a regular expression (regex) for a dynamic Id?

Good afternoon.
There are blocks like

<div id="popover-11415" class="popover" role="tooltip"><i class="close-btn"></i>Текст</div>

The number in the Div ID - varies for different blocks. You can somehow choose a regular expression so that the general expression for all blocks is of the popover* type
.
<div[^<>]*?id="popover-11415"[^<>]*?class="popover"[^<>]*?role="tooltip"><i[^<>]*?class="close-btn"></i>.*?<a[^<>]*?href=["'][^<>]*?["']>.*?</a></div>

But it accordingly collects only 1 block 11415

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Optimus, 2017-09-28
@TechNOIR

id=\"popover-[0-9]+\"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question