

















Here's a regular expression that matches the return value type, function name, and parameter type in C++:
(int|vector<int>|vector<vector<int>>|string|vector<string>|vector<vector<string>>|ListNode\*|vector<ListNode\*>|char|vector<char>|vector<vector<char>>|TreeNode\*|Node\*)\s(\w+)\((.*)\)
The regular expression uses the following components:
(int|vector<int>|vector<vector<int>>|string|vector<string>|vector<vector<string>>|ListNode\*|vector<ListNode\*>|char|vector<char>|vector<vector<char>>|TreeNode\*|Node\*) matches the return value type, which can be one of the specified types.
\s matches a whitespace character.
(\w+) matches the function name, which is one or more word characters.
\(.*\) matches the parameter list, which is zero or more characters enclosed in parentheses.
vector<int> f(vector<int>& a, TreeNode *b, int d){
}
vector<int> arg1 = {};
TreeNode * arg2 = new TreeNode(xxx);
int arg3 = 0;
vector<int> result = f(arg1, arg2, arg3);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。