比如要获取:
<color=#50cccc>头盔坐标:(-0.6, 1.0, 1.2)</color>
<color=#3d85c6>头盔方向(-0.2, 0.1, 0.1, 1.0)</color>
这样两个标签之间的值:头盔坐标:(-0.6, 1.0, 1.2)、头盔方向(-0.2, 0.1, 0.1, 1.0)
用C#实现:
string[] lines = File.ReadAllLines(@"C:\Users\xxxx\AppData\Local\Unity\Editor\Editor.log"); List<string> listPos = new List<string>();
foreach(var readLogsPos in lines)
{
foreach(Match m in Regex.Matches(readLogsPos, @"\<color=#50cccc\>(.*?)\</color\>"))
{
listPos.Add(m.Groups[].Value);
}
}
List<string> listRot = new List<string>();
foreach(var readLogsRot in lines)
{
foreach (Match m in Regex.Matches(readLogsRot, @"\<color=#3d85c6\>(.*?)\</color\>"))
{
listRot.Add(m.Groups[].Value);
}
}