use regexp to search function calls in code
Question
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...)
Solution
No, preg_match
is not better. When you want to parse PHP code, use the tokenizer
. It is far more reliable.
OTHER TIPS
Assuming that you have no function calls within the t() call, the simplest way to match them is
t\([^)]*?\)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow