Voici le modèle que je veux correspondre:PHP, preg_match, Expression régulière. Qu'est-ce que je fais mal?
<div class="class">
<a href="http://www.example.com/something"> I want to be able to capture this text</a>
<span class="ptBrand">
C'est ce que je fais:
$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);
Il imprime:
Array()
Is not {} délimitant. – manny