Utf8.gmatch

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function returns a pattern finding iterator for UTF-8 strings. The iterator will search through the string input looking for instances of the pattern you passed. For more information on iterators read the ForTutorial and IteratorsTutorial.

Syntax

iterator utf8.gmatch ( string input, string pattern )

Required Arguments

  • input: A string character sequence
  • pattern: A string match pattern

Returns

Returns an function for iterations on the input string by using the passed pattern string.

Example

Click to collapse [-]
Server

This example prints every word in the UTF-8 string

for word in utf8.gmatch( "Как вас зовут?", "%a+" ) do 
    print( word )
end

Output:

Как
вас
зовут

See Also