#!/usr/bin/env php ([^\s()]* ) *=(.*);$/', $row, $matches); if(isset($matches[1]) and isset($matches[2])) { $matches[1] = str_replace(array('[', ']', '/'), array('\[', '\]', '\/'), $matches[1]); preg_match('/\$lang->' . "$matches[1]\s*=(.*);\n/", $replaceContent, $replaceMatches); if(isset($replaceMatches[1])) $row = str_replace($matches[2], $replaceMatches[1], $row); } $replace .= $row; } fclose($enContent); file_put_contents($replaceFile, $replace); }