ExGram.Router.Filters.Regex (ex_gram_router v0.1.0)

Copy Markdown View Source

Built-in filter that matches text messages against a compiled regex.

This is similar to ExGram.Router.Filters.Text with a regex option, but is the underlying filter used when ExGram dispatches a :regex update (i.e., when the bot module has declared a regex/2 pattern and ExGram recognizes the text as matching it).

Usage

# Match a named regex update (declared via ExGram.Bot's regex/2 macro)
filter ExGram.Router.Filters.Regex, :email

# Match any regex update
filter ExGram.Router.Filters.Regex

Options

  • nil — matches any :regex update
  • atom — matches if the regex name equals the given atom