You could do it with REGEX if you want. Here is a not-so-elegant solution without REGEX though.
<?
$mystring = "this is something this is something";
$to_be_replaced = "something";
$replace_with = "[replaced]";
echo $string = substr_replace($mystring, $replace_with, strpos($mystring, $to_be_replaced), strlen($to_be_replaced));
?>
would output:
this is [replaced] this is something
I am sure the REGEX gods will flame me, but this should get you started.