You can use this:
local pattern = "%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x"
local guid = "3F2504E0-4F89-41D3-9A0C-0305E82C3301"
print(guid:match(pattern))
Note that:
- The modifier is
{8}not supported in the Lua template. -must be done with %-.- The character class is
%xequivalent [0-9a-fA-F].
A clear way to build a template using the helper table provided by @ hjpotter92:
local x = "%x"
local t = { x:rep(8), x:rep(4), x:rep(4), x:rep(4), x:rep(12) }
local pattern = table.concat(t, '%-')
source
share