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.
PHP代码是:
$cleanedVer = preg_replace('/[^0-9,.,a-z,A-Z-]/','',$someVer);
它会清除版本刺痛,但有时会清除太多信息。
我不确定这个PCRE正则表达式对上面代码片段中的字符串做了什么。有人愿意解释吗?
它会删除任何不是字母数字、点 (.)、逗号 (,) 或连字符 (-) 的字符。