|
|
|
|
|
by petre
1709 days ago
|
|
Well, that was inspired by sed. I have to do a test in Ruby too see how fast regexos are, being spoiled by Perl usage and all. What I don't like is this: my $a = 'Perl';
my $b = $a;
$b =~ s/pe/ea/i;
Why not do something to $a and obtain $b, just like js does with Array.map. Why the need to copy $a into to $b and then replace? Much more ellegant in Ruby: a = 'Ruby'
b = a.gsub(/ru/i, 'mo')
|
|
http://jultika.oulu.fi/files/nbnfioulu-202001201035.pdf