[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

$ anchor for string of a whole file

Peter Bailey

9/29/2006 3:56:00 PM

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

--
Posted via http://www.ruby-....

2 Answers

Peter Bailey

9/29/2006 4:17:00 PM

0

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-....

trotsky

11/16/2011 11:58:00 PM

0

On 11/15/11 11:15 AM, RichA wrote:
> On Nov 15, 10:14 am, wolfagain<w...@provide.net> wrote:
>> ... "The Stench is slowly fading!"
>
> The creeps will probably try to set-up in some other area. They
> should not be accorded the same time-frame again. Blomberg


Who?