Preg_match help

Many thanks to anyone who tries to help

I am using a form that when it is submitted is verified using the preg_match php functionality.

This works well except for one issue, the user comments box will not except a user using the enter key for paragraphing purposes within the comments area. This i know is because the function is set for only letters etc, but despite several hours of searching i cannot find out how to allow for use of the enter key.

Can anyone please let me know what value i need to accept and validate the enter key.

Means, you want to accept ’
’ character in your preg_match().

It is for reference for every character, how to specify the regex…

http://plan-b-for-openoffice.org/ooo-help/r2.1/en-US/MAC/shared/01/02100001

Thanks for the response, in a simple word Yes, i should have known that.

However i tried it, and my bad coding i reckon but cannot get it to work. Code below

<?php
// Validate comments field. Only allows letters, numbers, and hyphen, space, comma, period.

if(isset($_POST['comments']) &&!empty($_POST['comments'])){
if(!preg_match("/^[a-z0-9 ,.-]+$/i",$_POST['comments'])){
$errors[] = "You have submitted an invalid character in the Comments field, please use the back button and correct the entry.";
}
}
?>

i have tried putting both
and ’
’ inside the element but still get the error message.

Why would you limit what characters I can put in a comment?