PHP反转/否定正则表达式模式

PHP反转/否定正则表达式模式,php,regex,preg-match,Php,Regex,Preg Match,我有下面的字符串,我正在尝试使用正则表达式对任何与12c版本号不匹配的内容执行preg\u replace 你可以看到 我使用的表达式与12c字符串格式匹配,但我似乎不知道如何或是否有可能反转/否定正则表达式匹配,因此,与其替换12c,不如替换12c以外的所有内容,以便preg\u match函数只返回11g etc中的12c 代码: preg_match('/(\s[0-9]{2}[a-z]{1}\s)/', '', 'Oracle Database 12c Enterprise Editio

我有下面的字符串,我正在尝试使用正则表达式对任何与
12c
版本号不匹配的内容执行
preg\u replace

你可以看到

我使用的表达式与
12c
字符串格式匹配,但我似乎不知道如何或是否有可能反转/否定正则表达式匹配,因此,与其替换
12c
,不如替换
12c
以外的所有内容,以便
preg\u match
函数只返回11g etc中的12c

代码:

preg_match('/(\s[0-9]{2}[a-z]{1}\s)/', '', 'Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option');
/(\s[0-9]{2}[a-z]{1}\s)/ 
Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option
模式:

preg_match('/(\s[0-9]{2}[a-z]{1}\s)/', '', 'Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option');
/(\s[0-9]{2}[a-z]{1}\s)/ 
Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option
字符串:

preg_match('/(\s[0-9]{2}[a-z]{1}\s)/', '', 'Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option');
/(\s[0-9]{2}[a-z]{1}\s)/ 
Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option

如果我理解正确,您希望得到与模式匹配的文本:

if (preg_match('/([0-9]{2}[a-z]{1})/', 'Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing option', $m))
  echo $m[1]; // 12c

嗯,有点不清楚。请澄清并替换除12c以外的所有内容,以便preg_match函数只返回11g etc中的12c。值得注意的是,如果有机会,您当前的正则表达式也将从64位匹配
64b
。@apokryfos足以更改模式-
([0-9]{2}[a-z]{1(?}=\W}$)