I have a form with a Name field. I want to allow a user to be able to add a space, two words (first name and second name) or a hyphen but nothing else.
i.e names like Jo-Anne, Harry James, L S should be accepted but nothing like Harry James88, John@, KinG R3ginald etc.
This is my code in the source:
<input name="firstname" pattern="^[A-Za-z]+$" required="required" type="text" />
Please help me with the correct regex to be using here.
Thanks!