deem
deem

Reputation: 1884

preg_match_all() & UTF8 characters issue - the easiest way to go around

I need some easy (without mb_* and things like that) to go around this issue. I've tried something like preg_match_all('#[a-ząśćłóżźń]{3,}#', $text, $matches); but it doesn't work.

Upvotes: 1

Views: 2482

Answers (2)

Dejan Marjanović
Dejan Marjanović

Reputation: 19380

Try...

preg_match_all('#[a-z\x{0105}\x{015B}\x{0107}\x{0142}\x{00F3}\x{017C}\x{017A}\x{0144}]{3,}#uis', $text, $matches);

Upvotes: 2

Karolis
Karolis

Reputation: 9562

Use u modifier. For instance:

preg_match_all('#[a-ząśćłóżźń]{3,}#u', $text, $matches);

Upvotes: 3

Related Questions