preg_match RegEx
Posted: Tue May 19, 2009 5:51 pm
Hi,
I'm trying to make validation for my form and I have some problems with my RegEx.
I have for example a RexEx to validate the name and firstname.
The problem is that it don't work when I'm using post values
But when I hardcode a value it work
Both ways use the same RegEx why it don't work with $_POST but it do with hardcoded value. I need to use the $_POST.
Thank you
I'm trying to make validation for my form and I have some problems with my RegEx.
I have for example a RexEx to validate the name and firstname.
Code: Select all
'/^[A-ZÉÏÎÈÇ A-Za-z \-ZÉÏÎÈÇéïîèç]+([ ][A-ZÉÏÎÈÇ][a-zéïîèç]*)?[a-z \-éïîèç]*[a-zéïîèç]$/'
Code: Select all
preg_match('/^[A-ZÉÏÎÈÇ A-Za-z \-ZÉÏÎÈÇéïîèç]+([ ][A-ZÉÏÎÈÇ][a-zéïîèç]*)?[a-z \-éïîèç]*[a-zéïîèç]$/', $_POST['name']);
$_POST['name'] = 'Étienne';
Code: Select all
preg_match('/^[A-ZÉÏÎÈÇ A-Za-z \-ZÉÏÎÈÇéïîèç]+([ ][A-ZÉÏÎÈÇ][a-zéïîèç]*)?[a-z \-éïîèç]*[a-zéïîèç]$/', 'Étienne');
Thank you