【发布时间】:2018-10-09 11:44:22
【问题描述】:
我有一个具有这种结构的字符串(它是 Lua 表)
{['Name1']={score=235,x=6,y=88},['Name2']={score=112,x=12,y=55},['Name3']={score=15,x=15,y=56},}
为了便于阅读:
{['Name1']={score=235,x=6,y=88},
['Name2']={score=112,x=12,y=55},
['Name3']={score=15,x=15,y=56},} <--there might be more entries than these three of course
我需要为每个名称找到值 Name1、score、x 和 y。
我相信正则表达式可以做到,但我不擅长使用它。因此,如果有经验丰富的人给我一些模式,我会很高兴。
【问题讨论】:
-
使用
/\[\'(\w+)\'\]={score=(\d+),x=(\d+),y=(\d+)/