Codice PHP:
$text "['1','2']";

preg_match_all("/'(.*?)'/",$text,$matches);
foreach (
$matches[1] as $val) {
    echo 
$val.' - ';