<?php $re = '/(?<!\\\\)([\'"])(?:(?!(?:\1|\\\\)).|\\\\.)*+\1(*SKIP)(*FAIL)|\h+/m'; $str = 'abc | xx ?? "1 x \\\' 3" d e f \\\' y " 5 \\\' x yz abc | xx ?? \'1 x \\" 3\' d e f \\\' y " 5 \\\' x yz '; $result = preg_replace($re, '', $str); echo $result;
You have javascript disabled. You will not be able to edit any code.