Lua function
string.match
Summary
Searches a string for a pattern
Prototype
s = string.match (str, pattern, index)
Description
Find the first match of the regular expression "pattern" in "str", starting at position "index".
If found, returns any captures in the pattern. If no captures were specified the entire matching string is returned.
If not found, returns nil.
This is similar to string.find, except that the starting and ending index are not returned.
print (string.match ("You see dogs and cats", "s..")) --> see
See string.find for an explanation of regular expressions.
See Also ...
Topics
Lua base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua coroutine functions
Lua debug functions
Lua io functions
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua string functions
Lua table functions
Lua utilities
Regular Expressions
Scripting
Lua functions
string.byte (Converts a character into its ASCII (decimal) equivalent)
string.char (Converts ASCII codes into their equivalent characters)
string.dump (Converts a function into binary)
string.find (Searches a string for a pattern)
string.format (Formats a string)
string.gfind (Iterate over a string (obsolete in Lua 5.1))
string.gmatch (Iterate over a string)
string.gsub (Substitute strings inside another string)
string.len (Return the length of a string)
string.lower (Converts a string to lower-case)
string.rep (Returns repeated copies of a string)
string.reverse (Reverses the order of characters in a string)
string.sub (Returns a substring of a string)
string.upper (Converts a string to upper-case)
(Help topic: lua=string.match)
Documentation contents page
|