String.match

From GiderosMobile
Revision as of 11:02, 23 August 2018 by Hgy29 (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Find the first match of the regular expression "pattern" in "str", starting at position "index". The...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2011.6

Description

Find the first match of the regular expression "pattern" in "str", starting at position "index".

The starting position (index) is optional, and defaults to 1 (the start of the string).

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

(string), = string.match(stringpattern,)

'string: (String) Any string. '
'pattern: (String) Specifies the pattern to match. '
Returns (string) String matching pattern.