RosettaCodeData/Task/Strip-block-comments/Groovy/strip-block-comments.groovy

21 lines
365 B
Groovy
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
def code = """
/**
* Some comments
* longer comments here that we can parse.
*
* Rahoo
*/
function subroutine() {
a = /* inline comment */ b + c ;
}
/*/ <-- tricky comments */
/**
* Another comment.
*/
function something() {
}
"""
println ((code =~ "(?:/\\*(?:[^*]|(?:\\*+[^*/]))*\\*+/)|(?://.*)").replaceAll(''))