• Resolved frannyj

    (@frannyj)


    I have a single name text field that can contain a hyphen or a single quote (ex: Mary-Beth, O’Neal). I can get it to validate for hyphens, but not for a single quote (i.e. apostrophe). I have tried the expressions listed below. (p/s I also had my max length set to 15 — but even when I removed the setting, the apostrophe still didn’t validate). I tried passing in various character sets for the apostrophe, but I got PHP errors.). Does anyone know what I’m doing wrong?

    • /^[A-Za-z'-]+$/ — nope, apostrophe triggers the Regex fail message
    • /^[A-Za-z\'\-]+$/ — nope, apostrophe triggers the Regex fail message
    • /^[A-Za-z\-']+$/ — nope, apostrophe triggers the Regex fail message
    • /^[\-A-Za-z']+$/ — nope, apostrophe triggers the Regex fail message
    • /^['-A-Za-z]+$/ — nope, apostrophe triggers the Regex fail message
    • /^[\-A-Za-z']+$/ — nope, apostrophe triggers the Regex fail message
    • /^[\-A-Za-z\']+$/ — nope, apostrophe triggers the Regex fail message
    • /^[A-Z]'?[-a-zA-Z]+$/ — nope, apostrophe triggers the Regex fail message
    • /^[A-Z]\'?[-a-zA-Z]+$/ — nope, apostrophe triggers the Regex fail message

    https://wordpress.org/plugins/si-contact-form/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Regex on Name not accepting single Quote apostrophe’ is closed to new replies.