Salut,
J'ai une chaîne (un peu n'importe quoi mais c'est pour le test )
$tm = '<A HREF="index.php?R=1&R2=test test2r"><FONT COLOR="#000000">Titre</font></a><TD align="center"><A HREF="index.php?R=1&R2=test test2r"><FONT COLOR="#000000">DL</font></a><TR "GotoUrl(\'s840-Hiar-est.html#308\')" ><TD ><A HREF="GotoUrl(\'s840-Hiar-est.html#308\')" Title="Hi du est">Hi du est</A> -17- "GotoUrl(\'s840-Hiar-est.html#308\')" ><A HREF="index.php?R=1&R2=test test2r"><FONT COLOR="#000000">Titre</font></a><TD align="center"><A HREF="index.php?R=1&R2=test test2r"><FONT COLOR="#000000">DL</font></a><TR "GotoUrl(\'s840-Hiar-est.html#308\')" ><TD ><A HREF="GotoUrl(\'s840-Hiar-est.html#308\')" Title="Hi du est">Hi du est</A> -17- "GotoUrl(\'s840-Hiar-est.html#308\')" >';
Je voudrais enlever tous ce qu'il y a entre les quotes ".
Donc me retrouver avec
$tm = '<A HREF=><FONT COLOR=>Titre</font></a><TD align=><A HREF=><FONT COLOR=>DL</font></a><TR ><TD ><A HREF= Title=>Hi du est</A> -17- ><A HREF=><FONT COLOR=>Titre</font></a><TD align=><A HREF=><FONT COLOR=>DL</font></a><TR ><TD ><A HREF= Title=>Hi du est</A> -17- >';
J'utilse pour cela un regex pas très compliqué mais qui en même temps ne marche pas super bien.
$tm = preg_replace('`"[.*]"`i','',$tm);
Celui-ci me retire tous entre le premier " et le dernier de la chaine ...
$tm = preg_replace('`"[^ ]+"`i','',$tm);
Celui ne marche pas évidemment s'il y a un espace .. arg
Cela n'as pas l'air compliqué ... et pourtant ...
thx
Partager