Strip block comments

For extra credit, it allows the caller to redefine the delimiters.

func strip_block_comments(code, beg='/*', end='*/') {
    var re = Regex(beg.escape + '.*?' + end.escape, 's')
    code.gsub(re, '')
}
 
say strip_block_comments(ARGF.slurp)

Last updated