2021年4月5日星期一

Finding the definition range of the method { } with regex

I already can get if no braces in the method but as you can see in this example it matches with close() } } too. How can I get the method compeletely? or not possible with regex?

My regex

\w+\s*(\w+)?\s*\(([^{]+)([^}]+)  

Here is an example

void readFile(string filePath){      string line;      ifstream file(filePath.c_str());      (file.is_open()){          while(getline(file, line)){              str+=line;                  str+='\n';          }       file.close();      }  }  
https://stackoverflow.com/questions/66933570/finding-the-definition-range-of-the-method-with-regex April 04, 2021 at 12:40AM

没有评论:

发表评论