N
N
Noob--Saibot2017-03-11 19:55:45
PHP
Noob--Saibot, 2017-03-11 19:55:45

Why do I not get the desired result with such a regular expression?

Hi all! Tell me please. There is an html page.

class="product-list-item xs-100 sm-100 md-100 lg-100 xl-100"><div
class="product-thumb "><div
class="image">
<a
href="http://sait.com.ua/cat1/cat2/cat3/page10.html"  class="has-second-image" style="background: url('http://sait.com.ua/page-10-3-200x120.jpg') no-repeat;" >
<img

I'm trying to extract the address sait.com.ua/cat1/cat2/cat3/page10.html to php with a regular program.
Here it is:
class="product-thumb "><div\nclass="image">\n<a\nhref="(?<product_url>.*?)"

Here is my father-in-law and everything is fine https://regex101.com/
BUT! PHP script captures not only the address, but also what's next.
I don't understand why it behaves like this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Dart, 2017-03-11
@Noob--Saibot

The link immediately to your regular season would be thrown.
So what is the address you need? https://regex101.com/r/cZAcGg/1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question