I am building an extension for Opencart 2.3.x and I need to replace all occurences of DIR_IMAGE
with _DIR_IMAGE
, so I came up with this regular expression that works with PHP alone, but not within a VQMod mod:
<operation error="log">
<search position="replace"><![CDATA[/(.*?)(DIR_IMAGE)(.*?)/g]]></search>
<add><![CDATA[$1_DIR_IMAGE$3]]></add>
</operation>
This PHP-only does work:
preg_replace('/(.*?)(DIR_IMAGE)(.*?)/g', '$1_DIR_IMAGE$3', $string);
Can anyone point me in the right direction? At this point I assume alternatives to the expression above are appreciated.