Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试通过查找“t()”函数调用从我的源代码中的 .mo 文件,我知道一种更好的方法是使用正则表达式函数,如 preg_match 或其他东西,但我不是更好地创建正则表达式,任何帮助?
(对不起我的英语......)
不,preg_match不是更好。如果要解析 PHP 代码,请使用tokenizer. 它要可靠得多。
preg_match
tokenizer
假设您在 t() 调用中没有函数调用,匹配它们的最简单方法是
t\([^)]*?\)
考虑我们已经声明了一个这样的字符串:string x;和一个这样的字符向量:vector<char> x_vec; 我在想这样做有什么好处
string x;
vector<char> x_vec;
cout<<x;
超过
for(int i=0;i<x.length();i