Hi,
I am trying to make a code-highlighter which will pass through text which is posted from a form (My web management module). I basically want to have exactly the same system as used on this website. Add [ php] [ /php] tags, and you have highlighted syntax. Cannot get it to work however.
Have some trouble figuring this one out though:
$postedcode1 = $_POST[content]; // for now, quick and dirty retrieval
$match = array('#\[php\](.*?)\[\/php\]#se'); // match against the php tags
preg_match_all($match, $postedcode1, $matches); // do the matching
$match1 = "<?".$matches[0]."?>";
$postedcode = highlight_string($match1, true);
echo "<hr>".$postedcode."<hr>";
This goives me the error: Warning: Delimiter must not be alphanumeric or backslash in ...
referring to the preg_match_all statement.
What do I need to change to get it to work?
Anybody with better ideas on how to run this? It is a bit cumbersome..