- preg_replace: documentation ( source)
- mb_ereg_replace: documentation ( source)
<?php
$regex = '[^a]*a\\{';
$test_string = 'AAAAAAAAAAAAAA{AA';
echo "1:".mb_ereg_replace('/'.$regex.'/i','WORKED',$test_string)."\n";
echo "2:".preg_replace('/'.$regex.'/ui','WORKED',$test_string)."\n";
echo "3:".preg_replace('/'.$regex.'/i','WORKED',$test_string)."\n";