I've a problem that I couldn't solve myself: replace...
locale("Sendx", "Send")
locale("System", "System")
should become:
locale("Sendx", "Subsub")
locale("System", "Newsys")
I tried a simple replace:
$mysearchword = "System"; #changes in a loop
$myreplaceword = "Newsys"; #also changes in the loop
$oneline = str_replace($mysearchword, $myreplaceword, $oneline);
but the result looks like
locale("Sendx", "53ND")
locale("Newsys", "Newsys") #problem with the doubled word
of course the System was replaced both times. So I decided to use preg_replace
$pattern = '/locale\\(["|\']([^"\']*)["|\'], ["|\']([^"\']*)["|\']\\)/';
$replacement = '${1}, Newsys';
$subject = 'locale("System", "System")';
echo preg_replace($pattern, $replacement, $subject, -1 );
But now nearly anything is missing, because only the words in the brackets are returned and I have no idea how to include the pattern or return a replaced $subject. The $pattern changes, so I couldn't write "locale(..." into the $replacement / I somehow must return a replaced pattern...
System, Newsys # No idea how to combine $replacement with $pattern...
Could you please help me to get the right result?