Regex for name validation with Posix regex

Asked

Viewed 377 times

2

  • 1
  • that there is for java I am doing for c++ I tried to use this link you marked as duplicate to understand how to sweat Posix regex but I did not find anything that makes me accept accented names, alias if I do not use alpha or apace using letters it validates quietly...

  • Try this Regex: [A-ZÀ-Ý][a-zA-ZÀ-ÿ]+\s*[A-ZÀ-Ý][a-zA-ZÀ-ÿ]+ and the demo. I never used Posix, but the regexplanet apparently validated this expression in Posix.

  • My God I am not speaking of this regex: "(?:[á-úa-Za-z]+[ ]+[á-úa-Za-z]{0,20})?)?" validates names and surnames with or without accents if to exchange one syntax for the other is not worth I’m talking about using something like [:alpha:] [:alnum:] and do based on what is recognized eats with accents..

  • Read this reference and you will see that alpha does not include accentuation. Therefore, you have to use: [[:alpha:]À-ÿ]+. I suggest be more specific in your questions, thus, there is more chance of it being answered correctly. Including using the correct Tags and giving examples in a mcve.

  • more aesthetical than that? I have a c++ function that validates first and last names with the following regex : "((?:[á-úa-Za-z]+[ ]+[á-úa-Za-z]{0,20})?)?" was taking a look to let you learn how to create regex otherwise based on what’s on this site: https://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html so I did this: "((?:[[:alpha:]]+[[:space:]]+[[:alpha:]]{0,20})?)?" but names like Caesar and Tião it does not validate how I do it based on this type of regex?

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.