PHP preg_match - how to extend the range to accept accented utf characters?

Uglytoad

New member
How do I change the following preg_match function (which currently doesn't allow accented european chars) to allow accented european chars?

<?php

if(empty($formData['firstname'])
|| strlen($formData['firstname']) > 100
|| !preg_match("/^[a-zA-Z0-9_\-\' \á]{1,100}+$/", $formData['firstname'])) {

$is_error = true;
}

?>

I modified the preg_match function there to :-

if(empty($formData['firstname'])
|| strlen($formData['firstname']) > 100
|| !preg_match("/^[a-zA-ZÀ-ÖØ-öø-ÿ0-9_\-\' ]{1,100}+$/", $formData['firstname'])) {
$this->formError['firstname'] = "error show_block notop";
$is_error = true;
}

and then tried with firstname SÀND at it gave validation error.It is still not working. Please help
 
Back
Top