From: Peter Bailey Date: 2006-09-30T01:17:26+09:00 Subject: Re: $ anchor for string of a whole file Peter Bailey wrote: > I can't seem to get the regex I want when I'm searching for something at > the end of a file. I express it with relevant characters, followed by a > $. Because I've read in an entire file as one string into memory, > shouldn't $ mean the end of the file? And, shouldn't /m tell it to > include everying, including newlines? > > file_contents = File.read(psfile) > file_contents.scan(/(\%\%Blank page for Asura.*$)/m) do > file_contents.delete($1) > end > > Thanks, > Peter I had to correct "Asura$" to "Asura.*$" -- Posted via http://www.ruby-forum.com/.