1

Once again, I am stuck with some regex and I don't really know where to start.

I am using vQmod to build an OpenCart extension and I want to be able to search all files that have this code:

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template')

The problem is, the code above has more code in that line in each file. Is there a regex function that lets me search for part of a line of code with vQmod?

here is what I have tried so far:

<search position="before" regex="true"><![CDATA[~if \(file_exists\(DIR_TEMPLATE . $this->config->get\('config_template'\)~]]></search>

Thanks, Peter

Peter Stuart
  • 2,362
  • 7
  • 42
  • 73

1 Answers1

2

To search every catalog controller file (which is where all of these are) you would use

<file name="catalog/controller/*/*.php">

If you want to do a search for a regex, you use regex="true" and then place your regex in the CDATA tags

<search position="before|after|replace" regex="true"><![CDATA[~regex-here-including-delimiters~]]></search>
Jay Gilford
  • 15,141
  • 5
  • 37
  • 56
  • Hi Jay, thanks for your answer, I have updated my question with some example code that isn't quite working. Peter :) – Peter Stuart Jul 17 '13 at 19:06
  • @PeterStuart - You should get an error in your error log if it's not matching. Have you checked that no other vQmod has edited the file already in question? I also don't understand why you need a regex for this search? – Jay Gilford Jul 17 '13 at 23:20
  • It doesn't matter. I got it working. I just wasn't escaping characters properly. Your answer pointed me in the right direction, so thanks for that :) – Peter Stuart Jul 18 '13 at 13:16