View Full Version : String extraction from file using regular expression

01-30-2012, 01:59 PM
I have a .c file with many function calls like, say, "ABC ( x, y, z);"
My concern is to extract just the function name ABC. My approach is to read the file using streamreader.ReadToEnd(), and find the function name using regular expression \b\w+(\([a-z]*[0-9]*\)\b\w).

the function call may be of the form...
ABC ( xab, ybc,
zbc, hgs );"

i.e. the syntax is spread thru multiple lines. in the end i just want the function name ABC.

please help me with the regular expression or if there is any other approach.

Thank U