I need to use php to find and replace the database in a config file:
$cfg['database'] = 'my_database_name';
Basically, I'm trying to figure out a regular expression that would find everything between
$cfg['database'] =
and
;
then replace it with the actual database name. I think I would need to use preg_replace and then use the matches array, but I'm having a hard time trying to make it work.
Can someone give me an idea of how to go about this, or point me to a good resource that would address this specific type of replacement situation?