From: Helmut Leitner Date: 2002-12-31T19:22:18+09:00 Subject: How to translate this Perl regex Someone said that Ruby can do anything that Perl does. How would you write this Perl regex $s =~ s/(pat1+)pat2(pat3*)/&foo($1,$2)/ge; in Ruby? It - does a global replace (/g) in one sweep - executes code (calls function) to create the replacement string (/e) - uses parts of the searched patterns (groupings) as parameters to foo My books - Ruby in a Nutshell - The Ruby Way are very brief with respect to regexs and don't give me a clue how to do this. -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com