// bold, italic, underline, and strikethrough // These are worse than sed. Not only do you have to escape stuff, you have to // escape it again for PHP. $text = preg_replace('/(?\1', $text); $text = preg_replace('/(\\\\)\*\*/', '**', $text); $text = preg_replace('/(?\1', $text); $text = preg_replace('/(\\\\)\/\//', '//', $text); $text = preg_replace('/(?\1', $text); $text = preg_replace('/(\\\\)__/', '__', $text); $text = preg_replace('/(?\1', $text); $text = preg_replace('/(\\\\)--/', '--', $text); // external links $text = convert_urls($text); // links to wiki pages $text = preg_replace_callback('/(?', $text); return $text; }