你好,我有api函数,它基本上是数据库中的文本
这是我使用的功能
alpha(integer link, integer face, float alpha);
color(integer link, integer face, vector color, float alpha);
description(integer link, string description);
glow(integer link, integer face, glow);
name(integer link, string name)
position(integer link, vector position)
rotation(integer link, vector rotation)
texture(integer link, integer face, string texture_uuid, vector repeats, vector offsets, float rotation_in_radians)
基本上我想做的是运行一个正则表达式以将这些中的每一个作为数组返回,因为我尝试了很多次,并且运气不好,例如在纹理中,我需要选择我正在使用的uuid键
([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})
它适用于该字段,但由于我还有其他字段,它似乎没有进入数组,因为我不确定如何运行乘法正则表达式
链接和人脸也可以是负值,因为我使用了 (<[^>]*>|''w+(,它在一定程度上有效,但不是所有的 API 函数
知道如何构建正则表达式以处理所有 API 函数类型,因为我需要在这样的数组中使用它们
array(
[0] = function,
[1] = link
[2] = face
[3] = texture uuid
[4] = texture repeats
[5] = offset
[6] = rotation
)
这是使用纹理函数的示例,我希望我解释得足够多,因为我在这里很难寻求帮助
这是我使用的示例
https://regex101.com/r/vO2gW1/3 当你看到它坏了,因为不要拿起uuid
或者有没有办法使用正则表达式或其他方法将这些作为函数执行,甚至保持结构作为函数以使用PHP所需的格式返回数据
你可以
试试
^[^(]+(?='()|(?<=[(,])'s*'K(?:<.*?>|.*?)(?=[,)])
它应该拿起你需要的一切。演示。
它的作用是匹配字符串开头、逗号和括号之间的任何内容。所以它不适用于像anim(foo())
这样的东西.