这是我要匹配的模式:
<div class="class">
<a href="http://www.example.com/something"> I want to be able to capture this text</a>
<span class="ptBrand">
这就是我正在做的事情:
$pattern='{<div class="productTitle">[\n]<((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)>([^\n]*)</a>[\n]<span class="ptBrand">}';
preg_match($pattern, $data, $matches,PREG_OFFSET_CAPTURE);
print_r($matches);
它打印:
大批 ( )