I have a php file that can read the contents of other files perfectly and return them as a string.
$contents = $file->read(); // return as string.
i need to be able to search and replace certain lines
lines that begin with $this->Session->setFlash
and end with , true));
must be replaced with
lines that begin with
$this->Session->setFlash
and end with , true), 'default', array('class'=>'flash_failure'));
I have grep in my machine, if that helps.
finally after the contents is changed, i have a function that will write the contents back
$file->write($contents);
I know this helps to find the lines, but I have no idea how to replace.
^.*Session->setFlash.*, true\)\);$