[Solved] How to write regex in php for changing content?
[ad_1] Hey that sort of looks like JSON! <?php $file=” string PackageToRun[][] = { {“M16.1″,”M16.1EP1″,”M16.2″,”M17”}, {“Tv16.2″,”Tv17″,”Ta17″,”Ta16.2 MOpenTAS”,”Tv17.1″,”Ta17.1″,”T16.2″,”T16.2c”} }; “; if( preg_match(‘#string PackageToRun\[\]\[\] = ({.*});#is’, $file, $matches)) { $data = json_decode(str_replace(array(‘{‘,’}’), array(‘[‘,’]’), $matches[1])); print_r($data); } Output: Array ( [0] => Array ( [0] => M16.1 [1] => M16.1EP1 [2] => M16.2 [3] => M17 ) [1] … Read more