How to write the following href regular expressions?

Source: Internet
Author: User
How to write php regular expressions to obtain the following href regular expressions

test.htmltest                    wawahehehahauuuu              ......wawahehehahauuuu               ........

You want to use a regular expression Each href in the tag
How can I write it?


Reply to discussion (solution)

$html = <<
     test                        wawa            hehe            haha            uuuu              ......        
              wawa            hehe            haha            uuuu                           ........    TTT;preg_match_all('@
  ([^`]*?)<\/b>@i',$html,$match);preg_match_all('@href="(.+?)"@i',$match[0][0],$matches);var_dump($matches);
 

$html = <<
      test                        wawa            hehe            haha            uuuu              ......        
               wawa            hehe            haha            uuuu                           ........    TTT;preg_match_all('@
   ([^`]*?)<\/b>@i',$html,$match);preg_match_all('@href="(.+?)"@i',$match[0][0],$matches);var_dump($matches);
  


This is the firstFirst match, and then match the href
Is there a method that matches the regular expression?

I don't have this skill.
However, in addition to regular expressions, you can also use dom parsing, including simplehtmldom.

Can I match a regular expression?

~\ S * (] + href = "(.*?) "> .*?) *? \ S *~ Msi

In general, just tune it yourself

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.