I try to preg_match
the end of two html tags
<span class="a">
<span>123</span>
<span>456</span></span>
<span class="b">
<span>789</span>
....
I want to get the content of class a
(123 456) and try this pattern
preg_match('#<span\sclass="a">(.*?)</span></span>#')
but I just get the first span (123).
How can I end the pattern in </span></span>
<span class="a">([\\W\\w]*?)<\\/span><\\/span>
The dot .
only looks for non-newline characters, which means it would never get past the first line (in theory).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.