On Mon, Aug 12, 2002 at 06:30:22PM +0900, Tobias Reif wrote:
> Hi,
> 
> on Windows, I need to replace some values in a file; see the program below.
[...]
> 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 <object etc should stay.

(untested)

string.gsub! /(<(?:embed|object).+?width=)"\d+"/, "\1\"#{w}\""

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
  
Actually, typing random strings in the Finder does the equivalent of
filename completion.
	-- Discussion on file completion vs. the Mac Finder