Sorry for this basic question, but I've been looking over all the info about preg_replace I can find and I still can't figure this out.. I have a large string, like this, for example:
$string= '# tjs { fassdaf } #fsk { fssf} # fskff { casf }';
And when I do this, it replaces the entire pattern, not just the part in ( ) as I expect it to do.. I am wondering how I can just replace the part in ( ).. thanks
$pattern= '/#.*tjs.*\{.*(.*)\}/imsU';
$replacement= "test";
$return_string = preg_replace ($string, $pattern, $replacement );
expected replaced string:
'# tjs {test} #fsk { fssf} # fskff { casf }';