# Code Review: StringGsubWithPattern

**URL:** <https://www.ruby-forum.com/t/code-review-stringgsubwithpattern/141962>\
**Category:** IronRuby\
**Created:** [July 2, 2008, 2:58am UTC](https://www.ruby-forum.com/t/code-review-stringgsubwithpattern/141962 "2008-07-02T02:58:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Remy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@Dave\_Remy](https://www.ruby-forum.com/u/Dave_Remy)\
**Post date:** [July 2, 2008, 2:58am UTC](https://www.ruby-forum.com/t/code-review-stringgsubwithpattern/141962/1 "2008-07-02T02:58:41Z")

</div>

tfpt review “/shelveset:StringGsubWithPattern;REDMOND\dremy”  
Comment :  
Changes for string.gsub with pattern ruby specs to pass. The  
following tests now pass:

String#gsub with pattern, replacement replaces & and \0 with the  
complete match  
String#gsub with pattern, replacement replaces ` with everything  
before the current match  
String#gsub with pattern, replacement replaces ’ with everything  
after the current match  
String#gsub with pattern, replacement replaces + with the last paren  
that actually matched  
String#gsub with pattern, replacement treats + as an empty string if  
there was no captures  
String#gsub with pattern, replacement maps \ in replacement to   
String#gsub with pattern, replacement leaves \ at the end of  
replacement untouched
