Test, validate and match regular expressions
Validates personal names that begin with an uppercase letter and may contain letters, spaces, apostrophes, periods, and hyphens in the middle, matching names like O'Brien, Mary-Jane, or Anna Marie Smith. It requires at least two characters and prevents names from ending with a hyphen by ensuring the second-to-last character is a letter. Note that the final [^-] class accepts any non-hyphen character, including digits, which is a minor looseness. Typically used for validating name fields in web forms.