$foo = preg_replace("/<myhtml>(.*)<\/myhtml>/siU", "\\1", $foo); $foo = str_replace("<br />", "\n", $foo);