I'm not trying to pre-populate the text area. I just want to get the input from the user and make sure he can only insert chars that I allow. The only char I have a problem with is the " (Quote). If I enter a " into the text area the regexp bellow does not allow it in. preg_match("/^[à-úA-Za-z0-9_():,@\/\.\s\"- ]*$/i",$FieldValue) - Fails preg_match("/^[à-úA-Za-z0-9_():,@\/\.\s\\"- ]*$/i",$FieldValue) (This one gives a php error cause the \\" closes the opening ") preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s"- ]*$/i',$FieldValue) - Fails preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s\"- ]*$/i',$FieldValue) - Fails preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s\\"- ]*$/i',$FieldValue) - Fails So how can I allow a quote (") to be a valid char? thanks berber -----Original Message----- From: Richard Lynch [mailto:ceo@xxxxxxxxx] Sent: Saturday, December 16, 2006 3:55 AM To: WeberSites LTD Cc: php-general@xxxxxxxxxxxxx Subject: Re: RegExp On Thu, December 14, 2006 11:47 pm, WeberSites LTD wrote: > I'm trying to limit the text someone can submit in a text area with : > > > Code: > if(!preg_match("/^[à-úA-Za-z0-9_():,@\/\.\s\-\" ]*$/i",$FieldValue)) { > > } > > > It works well but I'm having problems with the " (double quote). > If there is a double quote (") it fails. Fails in what way? Are you sure you are remembering to do http://php.net/htmlentities on the data you send out for the TEXTAREA to pre-populate it? Does PCRE need " escaped inside the [] bit? I think not, but I suppose \\" instead of \" couldn't hurt. You may also want to move the - to the end of [] character set and lose the \, just to keep it simpler. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php