Difference between revisions of "Utf8.match"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2016.06<br/> === Description === Looks for the first match of pattern in the string s. If it finds one, then match returns the capture...") |
|||
Line 4: | Line 4: | ||
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. | ||
<source lang="lua"> | <source lang="lua"> | ||
− | (strings) | + | (strings) = utf8.match(s,pattern,init) |
</source> | </source> | ||
− | '''s | + | '''s''': (string) ''''''<br/> |
− | '''pattern | + | '''pattern''': (string) ''''''<br/> |
− | '''init | + | '''init''': (number) '''optional'''<br/> |
'''Returns''' (strings) captures<br/> | '''Returns''' (strings) captures<br/> |
Revision as of 10:17, 23 August 2018
Available since: Gideros 2016.06
Description
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.
(strings) = utf8.match(s,pattern,init)
's: (string) '
'pattern: (string) '
init: (number) optional
Returns (strings) captures