groovy or java: how to retrieve a block of comments using regex from /** ***/? -


this might piece of cake java experts. please me out:

i have block of comments in program this:

/*********  block of comments - line 1 line 2 ..... ***/ 

how retrieve "block of comments" using regex?

thanks.

something should do:

    string str =         "some text\n"+         "/*********\n" +         "block of comments - line 1\n" +         "line 2\n"+         "....\n" +         "***/\n" +         "some more text";      pattern p = pattern.compile("/\\*+(.*?)\\*+/", pattern.dotall);     matcher m = p.matcher(str);      if (m.find())         system.out.println(m.group(1)); 

(dotall says . in pattern should match new-line characters) prints:

block of comments - line 1 line 2 .... 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -