Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Rust

r"
(?<emoji>(:)([a-zA-Z0-9_]+)(:))|(?<embed_emoji>(\[)([a-zA-Z0-9_]+)(\])\([^()]*\))
"
gm

Description

NOTE

The word text is used to substitute all alphanumeric characters as well as underscores ([a-zA-Z0-9_]).

Captures:

  • [text](a) (the text in the parentheses doesn't get scanned)
  • [text]()
  • :text:

Doesn't capture:

  • [](text)
  • [text]
  • [text ]()
  • [ text]()
  • [ text ]()
  • : text:
  • :text :
  • : text :
Submitted by anonymous - 17 hours ago (Last modified 17 hours ago)