开发者

use regexp to search function calls in code

i try to make .mo files from my sources in php by finding "t()" function calls, i know that one better way is using regex functions like preg_match or something, but i'm not the better creating regular expresions,开发者_开发知识库 any help?

(and sorry for my english...)


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\([^)]*?\)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜