Problème fonction preg_match()
Bonjour à tous,
Je tiens à préciser avant tout que je suis novice dans ce langage.
Je souhaiterai tester le format d'un champs, si celui si correspond au format date MysSql yyyy-mm-dd, alors j’exécute du code, sinon je ne fais rien.
Voici mon code :
Code:
1 2 3 4 5 6 7 8
| if(preg_match('/^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/',$data[$tbl_LibelleColonne[$i]]))
{
$str_Champs = MiseEnForme_Date($data[$tbl_LibelleColonne[$i]], 2);
}
else
{
$str_Champs = $data[$tbl_LibelleColonne[$i]];
} |
Il me retourne comme erreur :
Warning: preg_match() [function.preg-match]: Unknown modifier '.' in /homez.221/partenart/www/ApplisW3b/Fonctions/fct_Presentation.php on line 35
Je n'ai pas réussi à résoudre, quelqu'un a t-il une solution ?
Merci à tous ....