Voila mon problème:
je voudrais afficher le prix du casque ou du velo (avec un preg_match). Lorsque j'utilise ce code et que je mets velo pas de prob ca affiche le prix. Mais pas lorsque j'affiche casque. Pourquoi ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<?php
    $chaine='<td nowrap="nowrap" align="left" valign="top">velo</td><td nowrap="nowrap" align="left" valign="top">CHF</td><td nowrap="nowrap" align="right" valign="top">654.12</td><td nowrap="nowrap" align="left" valign="top">casque</td><td nowrap="nowrap" align="left" valign="top">CHF</td><td nowrap="nowrap" align="right" valign="top">55.10</td>';
 
// la quand on met velo c est ok mais pas casque pkoi?
$motif='@^(?:<td nowrap="nowrap" align="left" valign="top">casque</td><td nowrap="nowrap" align="left" valign="top">CHF</td><td nowrap="nowrap" align="right" valign="top">)?([^<]+)@i';  
 
preg_match($motif,$chaine, $matches);
$host = $matches[1];
 echo $host;
?>
Merci