------_extPart_001_01C5C7E3.D3A52FE2
Content-Type: text/plain;
	charsetso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I'm guessing the reason it worked after splitting and not before is due to you not using a multiline regexp.
I believe in 1.8 regexp was changed to automatically be multi-line...if I recall correctly.
So it would have to be like gsub(/\n/m,"")

-Justin


-----Original Message-----
From: Kev Jackson [mailto:kevin.jackson / it.fts-vn.com]
Sent: Sun 10/2/2005 8:30 PM
To: ruby-talk ML
Subject: Re: ruby gsub! problem
 

>
> The typical Ruby idiom for this is:
>
> File.foreach(filename) do |line|
>     line.chomp!
>
>     # ... processing code goes here ...
> end
>
I didn't ry it to be honest, the real problem was that the data (when 
exported by another tool), has (\n) line endings at arbitrary places (ie n a typical 'line' of data).  So I really wanted to strip them out 
before resplitting on the real line delimiter ';'.  I actually worked it ut, I was trying filename.to_s.gsub!(/\n/, ''), but although ruby won't omplain about this, it won't operate on it, if instead I spli on my 
delimiter ';' and then do a line.gsub!(/\n/,'') everything works fine

Thanks for the help

Is the idiom above more for processing multiple files (for each file, 
for each line do some processing close) kind of thing?

Kev



------_extPart_001_01C5C7E3.D3A52FE2--