Reputation: 426
I would like to know how to find and replace the next ;
after command
command "bleh", 1234, 567;
to
command ("bleh", 1234, 567);
This way is important, because string between command and ; can be completly different. Thank you for your help!
Upvotes: 0
Views: 22
Reputation: 4220
You can use regular expressions and preg_replace():
$v = 'command "bleh", 1234, 567;';
$v = preg_replace('/command (.*?);/', 'command (\\1);', $v);
echo $v;
Upvotes: 1