Sanitise markdown text

Can anyone suggest a decent regex to sanitise an input field which should be Markdown text? I presently have

$transcript = preg_replace("/[^A-Za-z0-9_,.:;\n\- ]/", '', $transcript);

but I bet I haven’t got all allowed punctuation marks and I can’t help feeling there is a better way. Thanks

Would it not be easier to convert to HTML first, then sanitize that?

Thanks @fretburner maybe it would. I’ll have to think on that…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.