Regular expression for the functions

If you wanna have something like

int thisFunction(int a,
int b)
{


to be turned into


int thisFunction(int a,
int b)
{
printf("thisFunction Started");

You can search for functions using the following regular expression:

[[a-zA-Z0-9_-]+[\s]+]?[a-zA-Z0-9_-]+[*]?[\s]+[*]?([a-zA-Z0-9_-*]+)[\s]*\([\s]*([a-zA-Z0-9_-]+[\s]+[*]?[*]?[*]?[a-zA-Z0-9_-]+[,]?[\s]*)*\)[\s]*\{


update:

(static)?[\s]+(//inline//[\s]*)?[a-zA-Z0-9_-]+[*]?[*]?[\s]+([^\s\(]+)[\s]*\([^\)=]*\)[\s]*\{


Replace with:

\0 // \1 Started\r\nprintf("\1 Started");


update:

\0 // \3 Started\r\nprintf("\3 Started");

Comments

Popular posts from this blog

Timeline on Latex

Exporting Skype Chat/Skype Contacts to csv file using the shell script and sqlite3 (usually already installed on mac)

trim() not supported by IE7 and IE8