Search code examples
regexultraedit

Regex replacement issue: using group


I need to replace hundreds of if (ereg("avion","$keyw")) by if (preg_match("@avion@","$keyw")) {

I tried this:

1st : ereg\("(.*)"

2nd : preg_match\("@$1@"

But it replaces the first group by '$1'... Any idea please?


Solution

  • This is working on the UltraEdit version I have:

    enter image description here

    I'm just not sure why you have @ in your replace.

    You can pick "Current file" for all instead of the "Selected Text" I used for the comparison.

    Another thing to note, it might be safer to use:

    ereg\("(.*?)",
    

    Replace:

    preg_match("@$1@",