utf8.match
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
Extract substrings by matching patterns in the input string. This function can be used to extract specific information from a string.
Syntax
utf8.match ( )Code Examples
server
This example shows how to extract values from an input string by using a pattern to match the value parts.
local input = "Level: 5, Rank: General, 128.42 points"local level, rank, points = utf8.match( input, "Level: (%d+), Rank: (.-), (%d+.?%d*) points" )level, points = tonumber( level ), tonumber( points )
print( level, rank, points ) -- 5, General, 128.42