Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何替换除 ASCII/unicode 数字之外的所有内容:
ASCII 0-9 Unicode: ٠-٩
使用 PHP::RegEx,任何想法我需要什么代码?
提前致谢。
您可以使用\P{Nd}指定“任何不是十进制数字的字符”:
\P{Nd}
preg_replace('/\P{Nd}/u', '', $s)
$ret = preg_replace('/[^\d]/', '', $str);