$1", $asHtml); # Replace [text](link) with HTML links. Prevent ][ and )( in them $findBetween = "([^\n|\[\]]+)"; # Parse images first, since they require a ! in front of them $imageRegex = "/\!\[" . $findBetween . "\]\(" . $findBetween . "\)/i"; $asHtml = preg_replace($imageRegex, "", $asHtml); # Parse links, Prevent ! at beginning $linkRegex = "/(?!\!)\[" . $findBetween . "\]\(" . $findBetween . "\)/i"; $asHtml = preg_replace($linkRegex, "$1", $asHtml); # $asHtml = preg_replace("/```([^```]+)```/s", "$1", $asHtml); $asHtml = preg_replace("/\`([^\n]+)\`/i", "$1", $asHtml); # Replace --- and after with read more if needed if ($showRest == TRUE) { $asHtml = preg_replace("/---/s", "", $asHtml); $asHtml .= "Back"; } else { $asHtml = preg_replace("/---(.+)/s", "

Read more

", $asHtml); } # Replace two newlines with a paragraph element //$asHtml = preg_replace("/[\n][\n](.*)/i", "

$1

", $asHtml); return $asHtml; } ?>