twhite3000 / vqmod

Automatically exported from code.google.com/p/vqmod
0 stars 0 forks source link

iafter does not work with regex #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using vqmod version 2.4.1

It doesn't look like iafter works with regex.  

It works for this

      <search position="after" regex="true"><![CDATA[
        /<img.*product.*image.*\/>/
        ]]></search>

But doesn't work for this

      <search position="iafter" regex="true"><![CDATA[
        /<img.*product.*image.*\/>/
        ]]></search>

Am I using it wrong or is it a bug?

Thanks,

Tri

Original issue reported on code.google.com by tri...@gmail.com on 17 Sep 2013 at 3:22

GoogleCodeExporter commented 9 years ago
Hi Tri

This is not a bug. ibefore and iafter do not work with regex correct. You can 
use the regex to do what you want simply by using position="replace" and a 
capture group around your original search and using $1 or the appropriate group 
number followed by your new code

    <operation>
        <search position="replace"><![CDATA[/(regex-here)/]]></search>
        <add><![CDATA[$1new-code-here]]></add>
    </operation>

Original comment by DJG6...@gmail.com on 17 Sep 2013 at 4:03