我试图通过查找“t()”函数调用来制作.mo文件从PHP中的源代理,我知道一个更好的方法是使用像PREG_MATCH等的REGEX函数,但我不是更好地创建常规expresions,任何帮助吗?

(对不起我的英文...)

有帮助吗?

解决方案

No, preg_match is not better. When you want to parse PHP code, use the tokenizer. It is far more reliable.

其他提示

Assuming that you have no function calls within the t() call, the simplest way to match them is

t\([^)]*?\)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top