-
Notifications
You must be signed in to change notification settings - Fork 430
Regex Functions
zetaepyon edited this page Jan 9, 2018
·
2 revisions
Provides the most necessary regular expression functions Lua is lacking.
-
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.
-
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.
-
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.