I have a string that is a PHP code example that contains the following snippet:
$data = array(
'cKey1' => "dsfaasdfasdfasdfasdf",
'cKey2' => "asdfasdfasdfadsfasdf",
...
);
Currently I'm just doing a str_replace on two hard-coded keys, but I need this to be more flexible now. These are the two regex I've come up with so far:
(?<=cKey1' => ).+(?=,)
(?<=cKey2' => ).+(?=,)
But, due to some people not using spaces, using double quotes, etc, this is not an ideal solution. Can someone point me in a better way to replace the values of cKey1 and cKey2 in a more efficient way?
Thanks!