I am trying to only certain characters to be saved to the database from input of a textarea. The input is going to a variable called $vBody. What I have below works:
$vBodyCleaned = reg_replace('[^A-Za-z0-9~!@#$%&*()-_=+\'|:;",./? ]','',$vBody);
except for the fact that the client wants to preserve the line feeds and carriage returns. The above code strips them out. I have searched for an answer here and elsewhere. The problem is that I'm looking at it from the "allow" side rather than the "disallow" side. How do I add support for line feeds and carriage returns in my code?