From: ts Date: 2001-07-17T19:37:55+09:00 Subject: [ruby-talk:17981] Re: Regexp - stripping comments >>>>> "S" == Stuart Unsworth writes: S> word1 word2 "some text possibly with ;" + __FILE__ + "some more text" ; S> comments Sometimes regexp are not really adapted, try something like while l = DATA.gets l.chomp! if /^(?>[^;"]*(?:".*?")?)+/ =~ l puts $& end end the regexp is more complex if you can have \" in a string, or if you can have string between '' Guy Decoux