Regular expression (eacute)
Posted: Sat Feb 09, 2008 5:17 pm
Hi!
I have the following problem :
I want to test following strings with a regular expression (it is for testing names) :
O'Connor
Anne-Marie
Frédéric
Geneviève
...
and names including à, ä, ...
They should NOT contain numbers, *,%,&,/,. ...
I tried already this expression (without success) :
$regex = "/^([a-zA-Z]+)|(eacute\x3B)$/";
In fact, I think that following is correct :^[a-zA-Z-\é]+$
However, it does not work if I try to send a name via PHP to the validation file. It seems for instance that the é is not recognized as é, but as another letter. I have already tried to enter é, and then it worked seemlessly. But why doesn't the php recognize a simple é in the regexp, but a é entered by the user?
Could you help me please ?
Thank you very much !
I have the following problem :
I want to test following strings with a regular expression (it is for testing names) :
O'Connor
Anne-Marie
Frédéric
Geneviève
...
and names including à, ä, ...
They should NOT contain numbers, *,%,&,/,. ...
I tried already this expression (without success) :
$regex = "/^([a-zA-Z]+)|(eacute\x3B)$/";
In fact, I think that following is correct :^[a-zA-Z-\é]+$
However, it does not work if I try to send a name via PHP to the validation file. It seems for instance that the é is not recognized as é, but as another letter. I have already tried to enter é, and then it worked seemlessly. But why doesn't the php recognize a simple é in the regexp, but a é entered by the user?
Could you help me please ?
Thank you very much !