2
4

2 回答 2

1

You have to add the /u modifyer to the $regex to match unicode chars.

$regex = "/MATCH/u";

See: Pattern Modifiers

于 2013-10-04T10:17:45.767 回答
1

Solved it myself, used a roundabout method, but it works, the key is this regex:

/[一-龠]|[ぁ-ゔ]|[ァ-ヴー]|[a-zA-Z0-9]|[a-zA-Z0-9][々〆〤]/u

I used that to preg_replace any character with a single digit number and then found offsets in the new string.

于 2013-10-04T11:12:13.803 回答