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\([^)]*?\)
精彩评论