Difference between revisions of "String.match"
From OpenEUO
(Created page with " string.match (s, pattern [, init]) Looks for the first match of pattern in the string s. If it finds one, then match returns the captures from the pattern; otherwise it returns ...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
string.match (s, pattern [, init]) | string.match (s, pattern [, init]) | ||
Looks for the first match of pattern in the string s. If it finds one, then match returns the captures from the pattern; otherwise it returns nil. If pattern specifies no captures, then the whole match is returned. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative. | Looks for the first match of pattern in the string s. If it finds one, then match returns the captures from the pattern; otherwise it returns nil. If pattern specifies no captures, then the whole match is returned. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative. | ||
+ | |||
+ | [[String.find]] | ||
+ | |||
+ | [[String.gmatch]] | ||
+ | |||
+ | [[String.sub]] | ||
[http://www.lua.org/manual/5.1/manual.html#5.4.1 Lua Manual - String Patterns] | [http://www.lua.org/manual/5.1/manual.html#5.4.1 Lua Manual - String Patterns] |
Latest revision as of 12:58, 9 October 2010
string.match (s, pattern [, init])
Looks for the first match of pattern in the string s. If it finds one, then match returns the captures from the pattern; otherwise it returns nil. If pattern specifies no captures, then the whole match is returned. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative.