From: gga Date: 2006-08-14T04:40:06+09:00 Subject: Re: ruby equiv of perl pos Logan Capaldo ha escrito: > if perldoc -f pos is describing what pos does in this case, > > new_string = "" > while pos = string =~ /\0/g > new_string << "%o" % (pos - 1) > end This won't work. Regexp in ruby does not support Perl's /g option. You need to use String.index() with a position modifier as I showed before or gsub in case of a global regexp replacement.