How i can add UTF support

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
staar2
Forum Commoner
Posts: 83
Joined: Fri Apr 06, 2007 2:57 am

How i can add UTF support

Post by staar2 »

I have problems with this expression ([A-Za-z]+) how can i add here Estonian special chars ?
Like this ([A-Za-zöüõä]+) ?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

I think something like this:

Code: Select all

preg_match( '~[\x{4378}-\x{5642}a-z]+~ui', $stuff);
will match unicode code points. Test it though.
staar2
Forum Commoner
Posts: 83
Joined: Fri Apr 06, 2007 2:57 am

Post by staar2 »

hmm didn't get work, it dosen't allow to insert chars like this äüõö :oops:
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Make sure you are using the u pattern modifier and try just typing those characters in. Also make sure your source code file is UTF-8 (if it is indeed UTF-8 and not another UTF) and the input you are operating on is as well.
Post Reply