I checked this forum for a answer to my problem, but couldnt find. Experts please help.
I have a problem to validate a string say first name. I am given a set of rules w
Try this
[A-Za-z]+(?:[-'!` ]?[A-Za-z]+)?
You can check it online here: regexr
The second part
(?:[-'!` ]?[A-Za-z]+)?
is a non capturing group, this group is because of the ? at the end optional.
?