10

I have been unable to find what the allowed characters are while creating a shapchat (https://www.snapchat.com/) username. Can anyone here share their knowledge regarding this?

Context: I am creating a username validation system.

N.B. I have tried support.snapchat.com - but it provides no information regarding the allowed characters in a username.

JAHelia
  • 6,934
  • 17
  • 74
  • 134
SAZ
  • 127
  • 1
  • 1
  • 5
  • This is off topic here. This platform is about programing not about using applications – Christian Oct 02 '16 at 17:55
  • Why negative please? who knows is not a big deal for him. – SAZ Oct 02 '16 at 17:55
  • 3
    Then guide me. I found snapchat tag here and i think there is a relation with programming since i am creating a username validating system. – SAZ Oct 02 '16 at 17:57
  • 4
    why down vote? I found questions like this here, even `upvoted` 26 times `favorited` 10 times e.g. http://stackoverflow.com/questions/15470180/character-limit-on-instagram-usernames – SAZ Oct 02 '16 at 18:02

2 Answers2

21

From page 5 of Snapchat's law enforcement guide:


Snapchat usernames:

  • Must be 3-15 characters long
  • Can’t contain spaces
  • Must begin with a letter and ends with a number or letter
  • Can only contain latin letters, numbers, and one special character of the following allowed set: hyphen ( - ), underscore ( _ ), and period ( . )
  • Can’t contain emojis or other symbols such as @, $, #, etc.
JAHelia
  • 6,934
  • 17
  • 74
  • 134
Ashok Fernandez
  • 460
  • 3
  • 9
  • I agree. I have read the Snap Inc. Law Enforcement Guide and this should be the accepted answer. Unfortunately, OP has been inactive since Apr 2017, so this question may never have an accepted answer. – Ben May 03 '18 at 00:49
  • 6
    In case anyone ends up here looking to validate snapchat user names, the regex `/^[a-zA-Z][\w-_.]{1,13}[\w]$/` will match a valid Snapchat username, according to the above rules. Something to look out for though, Instagram also prevents you from using two periods together (`..`) - I'm not sure if Snapchat enforces this too – Jamie - Fenrir Digital Ltd Mar 24 '19 at 19:52
  • 2
    Be careful about using \w as that may well match non-ASCII characters like emojis, which are expressly forbidden. – Sam Kington May 29 '19 at 15:18
  • 2
    A small edit to Jamie's comment. Considering the minimum characters (3) and maximum (15), the regex would be ```/^[a-zA-Z][\w-_.]{3,15}[\w]$/``` – Zakher Masri Oct 15 '21 at 05:07
  • The regexes provided by @Jamie-FenrirDigitalLtd and Zakher doesn't work (tested on https://regex101.com – JAHelia Sep 02 '22 at 11:51
  • 1
    Just catching up on some old comments - my regex was broken, thanks @JAHelia `/^[a-zA-Z][\w\-.]{1,13}[a-zA-Z0-9]$/` I missed escaping the hyphen. Zakher if you happen to see this - the reason I used {1,13} is because you need to include the first and last characters which are defined separately in the regex. Sam - `\w` only matches characters `[a-zA-Z0-9_]` so would not match an emoji. Also changed final `\w` to not include underscore on final character – Jamie - Fenrir Digital Ltd Mar 09 '23 at 10:53
1

A regex to match the rules given in the other answer (if a positive lookahead is supported)

^(?=\S{3,15}$)[a-zA-Z][a-zA-Z0-9]*(?:[_.-][a-zA-Z0-9]+)?$

Explanation

  • ^ Start of string
  • (?=\S{3,15}$) Positive lookahead, assert 3-15 non whitespace chars to the end of the string.
  • [a-zA-Z] Match a single char a-z or A-Z
  • [a-zA-Z0-9]* Optionally repeat matching a-z A-Z or a digit 0-9
  • (?: Non capture group to match as a whole part
    • [_.-] Match one of _ . or -
    • [a-zA-Z0-9]+ Match 1+ occurrences of a-z A-Z or a digit 0-9
  • )? Close the non capture group and make it optional
  • $ End of string

See a Regex demo.

The fourth bird
  • 154,723
  • 16
  • 55
  • 70