【发布时间】:2022-01-28 05:59:13
【问题描述】:
我正在尝试为 PHP 构建一个 mime 类型数组列表。我得到了一长串 mime 类型,但我需要预先删除所有 'xxx' =>。如何使用正则表达式检测它们,因为我尝试了'[\u][a-z0-9]' =>,但没有成功。
'cpt' => 'application/mac-compactpro',
'cpt' => 'application/x-compactpro',
'cpt' => 'application/x-cpt',
'crl' => 'application/pkcs-crl',
'crl' => 'application/pkix-crl',
'crt' => 'application/pkix-cert',
'crt' => 'application/x-x509-ca-cert',
'crt' => 'application/x-x509-user-cert',
'csh' => 'application/x-csh',
'csh' => 'text/x-script.csh',
'css' => 'application/x-pointplus',
【问题讨论】:
-
或者试试
^[\s]+'[a-z]+' =>也会检测到你想要的文本,你必须使用^这意味着从每一行的开头...