Extracting number from string using lua
snippet in lua

Extracting number from string using lua

user3848

local a = "totalling  7,525.07" -- 7,525.07
print(string.match(a, '%S+$'))  -- 7,525.07
print(string.match(a, '%d[%d.,]*'))   -- 7,525.07
print(string.match(a, 'totalling%s*(%S+)'))  -- 7,525.07
print(string.match(a, 'totalling%s*(%d[,.%d]*)'))  -- 7,525.07
print(string.match(a, '%f[%d]%d[,.%d]*%f[%D]'))  -- 7,525.07