How can I match the regular expression? The purpose is to match href in the source code of a webpage. There are three possible types: & lt; thclass = & quot; new & quot; & gt; & nbsp; --- line feed --- & nbsp; --- line feed --- & lt; ahref = & quot; how does the http://bbs.111.com/threa match with regular expressions?
The purpose is to match href in the source code of the webpage. There are three types:
Type 1:
--- Line feed ---
--- Line feed ---
1111 (seo)
Type 2:
[Introduction to spider]Onclick = "atarget (this)" class = "xst"> 2222
Type 3:
3, 3, 3
Write $ pattern = "/". preg_quote ('', '/')." (. *) "." \ n "." ". preg_quote ('
','/'). ". +". Preg_quote ('class = "xst">', '/'). '/I ';
But it cannot be completely matched .. Please help
Let me talk about my ideas first:
Start with or, followed by extra characters, line feed (0 or more), and then end .. However, when matching, it is often not only the content of href, but also the content of other
------ Solution --------------------
PHP code
$ Str = <
1111 (seo) Type 2:
[Introduction to spider]2222 Type 3: Three html; preg_match_all ('/(? :). +