Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中匹配未转义字符_Php_Regex - Fatal编程技术网

在php中匹配未转义字符

在php中匹配未转义字符,php,regex,Php,Regex,在PHP中,我需要一个regexp来只匹配字符串中的单个/ "bla bla bla/bla bla bla" //The regexp must match the / character "bla bla // bla bla / bla bla" //The regexp must match only the last / not the first beacuse it is followed by another / 因此,我只希望您可以使用unescaped/来完成此操作 {(?

在PHP中,我需要一个regexp来只匹配字符串中的单个/

"bla bla bla/bla bla bla" //The regexp must match the / character
"bla bla // bla bla / bla bla" //The regexp must match only the last / not the first beacuse it is followed by another /
因此,我只希望您可以使用unescaped/

来完成此操作

{(?)?
这与a/匹配,但前提是不在前面加上另一个,也不在后面加上另一个/

$escaped=preg_replace('{(?<!/)/(?!/)}', '//', $original); 
$escape=preg_replace({(?您可以用于此

{(?)?
这与a/匹配,但前提是不在前面加上另一个,也不在后面加上另一个/

$escaped=preg_replace('{(?<!/)/(?!/)}', '//', $original); 
$escape=preg_replace('{(?)?