Google isn’t being much help, so I’m hoping someone on here could help me?
preg_match(‘^(MR|MRS)./s[a-z]/s[a-z]$/i’, $_POST[‘fullname’])
I need a regular expression that allows a name with the salutation of Mr. or Mrs. followed by two text strings separated by any number of spaces. Mine isn’t working and I have no idea why. Thank you in advance!
The regex is invalid syntax, it needs to start and end with the same delimiter:
Know however that this is a fragile regex to use – it is not uncommon to have multiple first names, to use a middle name, or to have a double barreled surname, or to have accents in your name – e.g. Zöe.
regex explanation