문제

When using preg_match('/^[\w-]+$/u', $value) my development server (5.3.15) returns true for umlaut words. My live server (5.3.2-1ubuntu4.19) returns false.

What do I have to do to make the live server behave the same way as my development server? (Unfortunately, I cannot simply update the php version.)

The code is exactly the same on both machines. Both serve pages as UTF8.

도움이 되었습니까?

해결책

\w is defined to be [A-Za-z0-9_] iirc.

try preg_match('/^[\pL-]+$/u', $value) instead.

http://php.net/manual/en/regexp.reference.unicode.php

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top