我是Lua的新手,很难理解模式匹配.我试图弄清楚如何在冒号后匹配字符串中的所有内容,并将该部分字符串放入变量中.我在网上四处看看并没有太多运气,或者我只是没有看到它.那我该怎么做呢?
例如,假设我有一个名为my_string等于"hello:hi_there"或类似的变量.如何"hi_there"在不改变的情况下提取到另一个变量my_string?
my_string
"hello:hi_there"
"hi_there"
看起来我需要使用string.match(),但是用什么模式来实现我的目标?
string.match()
lua lua-patterns
lua ×1
lua-patterns ×1