Regex Functions

zetaepyon edited this page Jan 9, 2018 · 2 revisions

Provides the most necessary regular expression functions Lua is lacking.

windower.regex.match(string, pattern)

  • string string - String to search
  • pattern string - Regular expression pattern to search for

Returns a table containing matches, if they are found. Nested tables contain further capturing groups. Otherwise returns nil.

windower.regex.replace(string, pattern, replace)

  • string string - String to search
  • pattern string - Regular expression pattern to search for
  • replace string | table | function - String, function or table to replace the match with

Returns string with all matches of pattern replaced with replace. If replace is a table it will look up the match in it, if it is a function, it will pass the match as an argument and replace it with the returned value.

windower.regex.split(string, pattern)

  • string string - String to search
  • pattern string - Regular expression pattern to search for

Splits a string on a certain regular expression pattern. Returns a list of strings.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.