From: angus Date: 2005-12-25T20:12:22+09:00 Subject: Re: convert perl code to ruby: help please [vnpenguin@gmail.com, 2005-12-25 11.02 CET] (Perl) > $str =~ s{ ( [aA] (?: [(^]? ['`?~.] | [(^] ) )}{$charmap{$1}}egox; (Ruby) > str.gsub(/([aA] (?:[(^]?['`?~.]|[(^]) )/){ |k| charmap[k] } You also should put a 'x' in the regexp options ^, at first I didn't notice the spaces. → /([aA] (?:[(^]?['`?~.]|[(^]) )/x Good luck.