regex - Remove All characters between to Tags in PHP -


I am trying to find a tag and remove the whole tag with a letter inside of a PHP file Want to This is a part of the text file that I want to change or delete it:

  // Some content between the code START // tag // code END //  

I have written this code:

  $ file = file_get_contents ('file.text'); $ File = preg_replace ("# // CODE START // (. ++) // CODE END // is", "," $$ "); File_put_contents ('new.text', $ file);  

The problem is that the code is not working! With this one I can delete the first row:

preg_replace ("# / / Code START // # i ", '', $ file);

But how can I remove those 3 lines? // CODE END // starts with // code START // .

Thanks

Update: I found it:

  $ file = preg_replace ("/ \ / \ / start the code \" ( /. +?) \ / \ / CODE END \ / \ // ims ", '', $ file);  

Spot the difference:

  // INSTALL END // ^^ --- two L's [..snip ..] "# // START // (INSTAL END // "", '', is a $ $ file); --- Single L  

Oh great , And a ninja edit completely exits from the water ...


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -