Skip to content

Instantly share code, notes, and snippets.

@Saw-mon-and-Natalie
Last active June 14, 2019 19:41
Show Gist options
  • Save Saw-mon-and-Natalie/246b8d0411cc9877df604936e519256c to your computer and use it in GitHub Desktop.
Save Saw-mon-and-Natalie/246b8d0411cc9877df604936e519256c to your computer and use it in GitHub Desktop.
Instagram Regular Expressions for allowed hashtags and mentions / usernames

Regular expressions for allowed hashtags and usernames on Instagram.

HASH_CHARS = "[#\uFF03]"
MENTION_MARKER = "([@@])"

default = /(^|[^a-zA-Z0-9_!#$%&*@])([@])([a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*)/g

Allowed usernames on instagram can only have the characters a-z, A-Z, digits 0-9, _ (underscore) and . (dot). A dot cannot be followed by a dot and cannot be at the beginning or end of the username.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment