Utf8.match: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''<translate>Available since</translate>:''' Gideros 2016.06<br/>
'''Available since:''' Gideros 2016.06<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/utf8|utf8]]<br/>
'''Class:''' [[utf8]]<br/>
=== <translate>Description</translate> ===
 
<translate>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.</translate>
=== Description ===
<source lang="lua">
Looks for the first match of ''pattern'' in the string ''s''.
<syntaxhighlight lang="lua">
(strings) = utf8.match(s,pattern,init)
(strings) = utf8.match(s,pattern,init)
</source>
</syntaxhighlight>
=== <translate>Parameters</translate> ===
 
'''s''': (string) <translate></translate> <br/>
If it finds one, then match returns the captures from the pattern; otherwise it returns nil.
'''pattern''': (string) <translate></translate> <br/>
 
'''init''': (number) <translate></translate> '''optional'''<br/>
If pattern specifies no captures, then the whole match is returned.
=== <translate>Return values</translate> ===
 
'''<translate>Returns</translate>''' (strings) <translate>captures</translate><br/>
A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative.
 
=== Parameters ===
'''s''': (string) <br/>
'''pattern''': (string) <br/>
'''init''': (number) '''optional'''<br/>
 
=== Return values ===
'''Returns''' (strings) captures<br/>
 
{{Utf8}}

Latest revision as of 21:01, 1 December 2023

Available since: Gideros 2016.06
Class: utf8

Description

Looks for the first match of pattern in the string s.

(strings) = utf8.match(s,pattern,init)

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.

Parameters

s: (string)
pattern: (string)
init: (number) optional

Return values

Returns (strings) captures