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. 以下是什么regex:
PHP
regex
EXACTLY {{file: THEN 24 characters from a-zA-Z0-9 THEN EXACTLY }}
例子:
{{file:504c2ee3ff558cb40700000b}}
寻找匹配该模式。非常感谢。
尝试:
preg_match_all('/\{\{file:[a-zA-Z\d]{24}\}\}/', $str, $matches);
试试这个,
preg_match_all('((\{{2})file:([a-z0-9]){24}(\}{2})/i', $str, $matches);