User Tools

Site Tools

Command disabled: resendpwd

addons:functions:regex

Regex Namespace

The regex namespace contains functions that expose C++ regex functionality to Lua. Due to Lua's limited regular expression functions, users may need some better regex support from C++ which this namespace provides.

You can access these functions via:

ashita.regex.


ashita.regex.match

Matches a given pattern. (Calls std::regex_match)

table ashita.regex.match(message, pattern);

  • Parameters
    • message - (string) The message to search within.
    • pattern - (string) The pattern to match.
  • Returns
    • table - A table of the match information, nil on error.

ashita.regex.search

Searches for a given pattern. (Calls std::regex_search)

table ashita.regex.match(message, pattern);

  • Parameters
    • message - (string) The message to search within.
    • pattern - (string) The pattern to match.
  • Returns
    • table - A table of the match information, nil on error.

ashita.regex.replace

Replaces matches found within a message.. (Calls std::regex_replace)

string ashita.regex.replace(message, pattern, rep);

  • Parameters
    • message - (string) The message to search within.
    • pattern - (string) The pattern to match.
    • rep - (string) The string to replace when the pattern is found.
  • Returns
    • string - The replaced string, nil on error.

ashita.regex.split

Splits a string based on a pattern. (Calls std::sregex_token_iterator)

table ashita.regex.replace(message, pattern, rep);

  • Parameters
    • message - (string) The message to search within.
    • pattern - (string) The pattern to match.
  • Returns
    • table - The split parts found from the pattern, nil on error.
addons/functions/regex.txt · Last modified: 2017/04/22 01:28 by atom0s