okay, first of all, you've got to use preg_replace, with the mysterious /e modifier.
this is kind of like eval(), but enough not like it to be really confusing.
effectively, this treats the replacement string as if it's just been echoed; evaluating functions and variables as normal.
$contents = preg_replace("/(a.b)|(c.d)/e","' myFunction('\1').'*'.myFunction('\2')'",$contents);
note particularly the quoting of the replacement string: the whole thing is a string: in this context
" ' text '.$variable "
is rendered as
eval(" echo ' stuff '.$variable ") ;
the reason your function appears to be partly working is not because it's returning 'abb', but is returning '\1' which is then being replaced with the backreference.
hope this helps.
--
rad