我有这样的字符串:
hello item:::::405498:::244405553::3405:34:405:59:::445:447:3205:::[test] and another 405 with test
我需要捕捉字符串的最后一部分,忽略
:
作为分隔符。
在我的具体情况下,我需要找到最后一个
405
,忽略先出现的:405498:
:244405553:
:3405:
和:405:
我真的是 Lua 的菜鸟,到目前为止我已经尝试与
:(.-):
相匹配,但我认为我离正确的解决方案还很远
要查找字符串中的最后一个数字,忽略用冒号包围:
s = "hello item:::::405498:::244405553::3405:34:405:59:::445:447:3205:::[test] and another 405 with test"
print(s:match".*%f[%d:](%d+)%f[^%d:]") --> 405