Community Patterns

Community Library Entry

2

Regular Expression
Created·2024-12-14 18:33
Updated·2024-12-14 18:36
Flavor·Rust

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

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