Regular Expression Question

Posted by zyq524 on Stack Overflow See other posts from Stack Overflow or by zyq524
Published on 2010-04-23T14:41:24Z Indexed on 2010/04/23 14:43 UTC
Read the original article Hit count: 280

Filed under:
|

I'm trying to use regular expression to extract the comments in the heading of a file.

For example, the source code may look like:

//This is an example file.
//Please help me.

#include "test.h"
int main() //main function
{
  ...
}

What I want to extract from the code are the first two lines, i.e.

//This is an example file.
//Please help me.

Any idea?

© Stack Overflow or respective owner

Related posts about regex

Related posts about python