From: Tobias Reif Date: 2002-08-12T18:30:22+09:00 Subject: replacing values in some files: line endings etc Hi, on Windows, I need to replace some values in a file; see the program below. 1. ff The file is in Unix fileformat; but when Ruby wrote to it, there are DOS line endings instead of Unix one, AFAICS. That's what I think what happens. What I see is: I open the file in Vim (which is ff=unix); everything looks fine. I run the Ruby program, then Vim prompts me to relaod the file; after this, every line ends in ^M. When I reopen the file in Vim, everything looks OK again; I think Vim converts the dos line endings automatically since I have set ff=unix in my vimrc. I really would prefer if Ruby would only gsub the stuff I ask it to, not the line endings. 2. gsub How could I match a longer string, but replace only a part of it? eg ~ string.gsub! /<(embed|object).+?width="\d+"/, "width=\"#{w}\"" ... but the