I have a Python regex which validates names given by a user in a chatbot.
(?=.{2,100}$)[^\W\d_]{2,}(?:[-\s][^\W\d_]{2,})*
As you can see in the demo, it works great, but I have still problems for the following inputs:
- Mathias d'Arras
- Mike O'Neal
- Peter.
- Peter?
- Peter!
- Boby-Dick.
- Boby-Dick?
- Boby-Dick!
As you can see, I want my regex match even if the user types his name with a punctuation mark. How would you improve the regex?