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.
我想要一个正则表达式,它可以帮助我获得 cc 之前的 4 个数字。 RegEx 必须包含cc以识别这些确切的数字。
cc
例子:
1600cc
preg_match('/(\d{4})cc/', $string, $match);
$match[1]将包含数字。
$match[1]
你应该使用:
/(\d{4})cc\b/
\b确保这"cc"是在单词的和。
\b
"cc"