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
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.*$”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.