>>>>> "R" == Ryan Flynn <parseerror / gmail.com> writes:

R> $ irb
R> irb(main):001:0> $_="meeet"  
R> => "meeet"
R> irb(main):002:0> gsub(/(.)(\1)/, '\1x\2')
R> => "mexeet"
R> irb(main):003:0> gsub(/(.)\1/, '\1x\1')
R> => "mexexet"
R> irb(main):004:0>

svg% irb
irb(main):001:0> $_="meeet" 
=> "meeet"
irb(main):002:0> gsub(/(.)\1/, '\1x\1')
=> "mexeet"
irb(main):003:0> gsub(/(.)(\1)/, '\1x\2')
=> "mexexet"
irb(main):004:0> 

R> the behavior to be identical... can anyone shed some light?

 You work with $_ which is modified, i.e.

svg% irb
irb(main):001:0> $_="meeet" 
=> "meeet"
irb(main):002:0> gsub(/(.)\1/, '\1x\1')
=> "mexeet"
irb(main):003:0> $_
=> "mexeet"
irb(main):004:0> gsub(/(.)\1/, '\1x\1')
=> "mexexet"
irb(main):005:0> $_
=> "mexexet"
irb(main):006:0> 




Guy Decoux