在 Lua 中查找字符串中的两个数字

我想要使用 Lua 的某种方法来从以下字符串中隔离出数字 98 和 7,525.07。

"I can confirm todays incident total file has been uploaded. There are 98 incidents totalling 7,525.07"

什么是完成此操作的最佳方法?

我有以下代码可以捕获第一个数字,但我在捕获第二个数字方面遇到困难

number = string.match(
    "I can confirm todays incident total file has been uploaded.   There are 98 incidents totalling  7,525.07",
    "%d+"
)
点赞
用户7504558
用户7504558

如果第一个值只包含数字字符,您可以使用以下匹配:

local s =“我可以确认今天的事件总共上传了文件。共有98次事件,总计为7,525.07print(s:match(“. -(%d +) 。 -(% [%d%。%,] +)”))
2017-10-16 16:34:07