Jump to content

apostrophe in verification string


turpentyne

Recommended Posts

I can't get this bit of verification to recognize the apostrophe. I've tried putting the apostrophe in the front of the A, escaped it with a backslash. Escaped the backslash itself, like you see below. Nothing seems to get that apostrophe recognized.

 

$first_name = $_POST['first_name']; // required

  $string_exp = "/^[A-Za-z\\-\\., \\']+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';

 

I've tried quite a few combinations. Here are a few more that didn't work:

 

$string_exp = "/^[A-Za-z\\-\\., \']+$/";

 

$string_exp = "/^[A-Za-z\-\., \']+$/";

 

$string_exp = "/^[A-Za-z' .-]+$/";

 

$string_exp = "/^[A-Za-z .'-]+$/";

 

Link to comment
https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.