...

View Full Version : Resolved preg_match help to allow enter in textarea box



CBG
12-15-2010, 10:36 AM
Hi,

I currently have the below code to check the textarea box.



if (preg_match("#^[a-zA-Z0-9 .,?_/'!$%&*()+=-]+$#", $msgs)) {
// Everything ok. Do nothing and continue
} else {
echo "Message is not in correct format.<br>You can use a-z A-Z 0-9 . , ? _ / ' ! $ % * () + = - Only";


However the problem is, when putting enter in the message if fails
For example if I put the message



this
message
doesnt
work


It fails and echo the else

But if I put


this message does work


It is ok


Could someone tell me what extra bit of code I need to add to the preg_match and where.

Thanks for the help :)

CBG
12-15-2010, 11:27 AM
Got help from another forum I posted on.
Answer was: #^[a-zA-Z0-9 \.,\?_/'!\$%&*()+=\r\n-]+$#



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum