According to the manual, the preg_replace keyword in Squiz 6 has “the same functionality as the preg_replace() PHP function”.
I’ve tried to use the Regular Expression assets with arrays in both the REGEX and REPLACEMENT fields, but it doesn’t seem to interpret them as no replacements take place.
I’m using the standard Squiz/PHP notation for arrays - [ “foo”, “bar”, “baz” ] and [ “1”, “2”, “3” ] for REGEX and REPLACEMENT.
Here’s the extract from PHP’s manual regarding preg_replace - " If both pattern
and replacement
parameters are arrays, each pattern
will be replaced by the replacement
counterpart."
I’m taking ‘pattern’ to be REGEX in Squiz.
Any ideas? Is this a future enhancement? Am I missing something? Can we expect to be able to use arrays in both parameters in the future? The latter would be useful, as I could see situations where things like responses from SOAP or REST could be used to substitute text on a webpage perhaps and for example.