0
4

1 回答 1

2

Try adding the Unicode flag:

$regex = '@[۱]@u';

The reason for this is because ۱ is actually several bytes long. On it's own, it's harmless because those exact bytes are either the symbol, or the individual bytes being there coincidentally. However, in a character class any of the individual bytes may match any of the individual bytes in the other characters, which is does because they are close together in the map.

于 2012-11-09T17:58:50.563 回答