Simple Regex help

IO.readlines( 'file.txt' ).delete_if{ |line| line =~ /^!.*!$/ }
#=> returns an array; you may want to .join it with the newline
seperator.

···

On Jan 12, 6:37 pm, "itsme213" <itsme...@hotmail.com> wrote:

I have a file of code that has "!"-delimited lines and other non !-delimited
lines. I want to remove all the "!"-delimited lines

!some stuff that i do not want!

lots of other stuff that i want
lots of other stuff that i want

!some stuff that i do not want!

lots of other stuff that i want
lots of other stuff that i want

What would be a simple ruby script to use regex and remove all the
!....!

Files with \n only as the line separator are produced by Mac OS X, and
other unix/linux/*nix OS applications.

Files with \r\n as the line separator are produced by Windows.

Files with \r only as the line separator are produced by MacOS 9
applications, or confused programs/programmers.

I'm surprised that you have a file with really just \r.

···

On Jan 12, 10:09 pm, "itsme213" <itsme...@hotmail.com> wrote:

Oops, spoke too soon. The file seems to have just '\r' at the end of each
line (Unix vs. Windows?).