-1

Possible Duplicate:
How to match Cyrillic characters with a regular expression

I have a simple php script which uses preg_match to compare a string against some cyrillic text inside a variable (e.g. $var = 'страница').

However when I input the cyrilic text into the variable it comes up as ???????? in my code.

$var1 = '/?????????????/';

I get the folowing warning when I run the script:

preg_match(): Compilation failed: nothing to repeat at offset 0

Can anyone suggest a solution? thanks very much.

Community
  • 1
  • 1
user1563414
  • 91
  • 1
  • 3
  • 9

2 Answers2

1

Change encoding of your scripts or all project source files on UTF for example in your IDE.

Dmytro Zarezenko
  • 10,526
  • 11
  • 62
  • 104
0

Use modifier for unicode

preg_match('/abcdef/u',$some_string)

Maybe it’s because of invalid codepage, which codepage has your interpreter and which codepage uses connection to a database (if any?)

tijagi
  • 1,124
  • 1
  • 13
  • 31