M
M
MZhack2020-11-27 16:51:17
PHP
MZhack, 2020-11-27 16:51:17

How to correctly form a regular expression in php?

There is a html page about 150 MB in size. It is necessary to get all links of the type from it . As I understand it, it is necessary: ​​in php, through file_get_content(), get an html page, then through preg_match_all, extract all the links to the photos I need from it, put them in an array, then output this array no longer in the form of links, in the form of pictures. But how to implement it - there are not enough brains already at the moment of the regular expression. For help - thank you with a coin). Link Example<a target="_blank" href="*">[photo-*</a>

<a target="_blank" href="https://site.com/blablabla/blablabla/blablabla.jpg?size=941x1080&quality=96&proxy=1&sign=blablablac&c_uniq_tag=blablabla">[photo-51238529_457283437] (941x1080)</a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2020-11-27
@alexalexes

I just took the regular expression from answer a.
<a\s.*?href="(.+?)".*?>\[photo-.+<\/a>
And I picked it up at random in the online editor .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question