In general, to be able to correctly delete comments from a language, you need to be able to fully or partially parse it. I seriously doubt you'll be able to remove comments from Ruby with a handful of simple regexes. You certainly will not be able to do this correctly by looking it line by line.