How to use php regular expressions to extract html tags
How to use php regular expressions to extract html tags
· Shanghai steel market price summary in March 14 March 14 · Price Summary of Beijing steel market in March 14 March 14 · Tianjin Steel market price summary in March 14 March 14 · Chongqing steel market price summary in March 14 March 14 · Price Summary of Guangzhou steel market in March 14
I want to get all×××In the middle of the tag, how should I write a regular expression?
Reply to discussion (solution)
$pattern = "/([\s\S]*)<\/td>/"; preg_match_all($pattern, $str, $matches); var_dump($matches);
The test can pass
$pattern = "/([\s\S]*)<\/td>/"; preg_match_all($pattern, $str, $matches); var_dump($matches);
The test can pass
Change rules
$pattern = "/([\s\S]*?)<\/td>/"preg_match_all("/
(.*)<\/td>/iUs", $str, $output);print_r($output);
The above is the question about extracting html tags using php regular expressions. For more information, see PHP Chinese website (www.php1.cn )!
Related articles:
Php code example for extracting html tags
Use php to extract HTML tags
Php regular expression to extract Image URLs