$ anchor for string of a whole file

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

Peter B. 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.*$”