#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    Lightbulb Asking for opinions on name validation


    Should I assume it possible for people to have 1-letter names for the website I'm building, or should names be required to be at least 2 characters long? Should I allow underscores in a name, or any other characters in particular? Reasons with opinions please.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Oxford, United Kingdom
    Posts
    40
    Rep Power
    2
    Well in reality, parents can name their children whatever they like. However, I've never seen a name with just one letter.

    I don't thing allowing users to use 1 letter names will do any harm (unless your target users are 12 year old girls under the delusion of Justin Beiber being their husband..).

    But I would go with two letters as the minimum. Just because I think it's very unusual for someone to have a name containing just one letter.

    I don't see why you should allow underscores. But you should allow hyphens and dots (.).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    Thanks, I wouldn't have thought to include dots of hyphens! I can see why that would make sense. I'd also like to add to this thread that in my current regex I've also included accented vowels. I might as well post it in case anybody here may find it useful:

    ^[a-zA-Z0-9\.\-]{2,50}$
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    arbitrarily choosing a few diacritics doesn't make a lot of sense, because there are many more of them (depending on the language).

    Is this about real names or just user names? For user names, I'd only allow the alphanumerics (and maybe spaces) to ensure distinguishable and easy to type names. For real names, you probably want the printable characters from the first few blocks of the Basic Multilingual Plane plus spaces.

    But be aware that "advanced" characters can be misused. For example, ligatures (letters composed from multiple characters) might be indistinguishable from a simple sequence of their components. So users might be able to "steal" the names of other users.

IMN logo majestic logo threadwatch logo seochat tools logo