Hi.
I'm trying to validate a form using ereg().
But it's a Norwegian page and the characters: Ææ,Øø and Åå, will appear. Thus making the form validation false.
How can I, if possible, adapt ereg to recognise these characters as valid?
| SitePoint Sponsor |


Hi.
I'm trying to validate a form using ereg().
But it's a Norwegian page and the characters: Ææ,Øø and Åå, will appear. Thus making the form validation false.
How can I, if possible, adapt ereg to recognise these characters as valid?





Hi,
You can specify any characters you want as shown below.
I hope this can help you.PHP Code:if(ereg('^[a-zA-ZÆæØøÅå]+$', $string))
Yours, Erik.





The more common solution is to setup your locale accordingly (see http://www.php.net/manual/en/function.setlocale.php). Among regexps, this affects other vital things like sorting etc. And do not use ereg, it's deprecated.





Where is this announced?Originally Posted by stereofrog
Lats...





Hi,
The ereg functions are not deprecated. However, it is better to use the PCRE functions since they are faster.Originally Posted by stereofrog
Yours, Erik.
Bookmarks