1

寻找一些正则表达式帮助使用PHP. 以下是什么regex

EXACTLY {{file: THEN 24 characters from a-zA-Z0-9 THEN EXACTLY }}

例子:

{{file:504c2ee3ff558cb40700000b}}

寻找匹配该模式。非常感谢。

4

2 回答 2

2

尝试:

preg_match_all('/\{\{file:[a-zA-Z\d]{24}\}\}/', $str, $matches);
于 2012-09-09T07:16:05.843 回答
0

试试这个,

preg_match_all('((\{{2})file:([a-z0-9]){24}(\}{2})/i', $str, $matches);
于 2012-09-09T07:28:56.580 回答