Georgi Georgiev
Georgi Georgiev

Reputation: 3964

preg match (): range out of order

I need to match a string that contains only Cyrillic letters so I try this:

<?php  
$pattern="#[x\{0410}-x\{042F}]#u";  
$string="АФ";  
echo preg_match ($pattern,$string);  
?>  

But I get this error

Warning: preg_match(): Compilation failed: range out of order in character class at offset 10 in /home/ge0rgi/www/preg.php on line 4

Upvotes: 0

Views: 634

Answers (2)

user474470
user474470

Reputation:

you have not opened '{' statement. because before it you have slash. that's why there is undefined ending at 10 and 19 chars

Upvotes: 2

Dejan Marjanović
Dejan Marjanović

Reputation: 19380

$pattern= "#[\x{0410}-\x{042F}]#u"; 

Returns 1 but doesn't match F...

Array
(
    [0] => А
)

Upvotes: 0

Related Questions