I have a string that is uses backslashes to escape special characters. For instance, this string:
Code: Select all
Test 1\n\\n\\n\nTest 2\n\'\'\'\nTest 3Should appear as:
The string was obtained by double-escaping (with mysql_real_escape_string()) the contents of a textarea box. Is there a simple way that I can convert this string into HTML-formatted text? That is, <br> in place of \n and ' instead of \'. I was considering a regular expression replacement, but I couldn't figure out how to properly account for \\n (and the like).Test 1
\n\n
Test 2
'''
Test 3
I hope this makes sense. Let me know if you need any more information.
Thanks!