edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RegexpTransformer.cs;C737451
File: RegexpTransformer.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RegexpTransformer.cs;C737451  (server)    2/9/2009 11:54 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RegexpTransformer.cs;re
@@ -40,6 +40,10 @@
         StringBuilder/*!*/ _sb;
 
         internal static string Transform(string/*!*/ rubyPattern, RubyRegexOptions options) {
+            if (rubyPattern == "\\Af(?=[[:xdigit:]]{2}+\\z)") {
+                // pp.rb uses this pattern. The real fix requires cracking the entire regexp and so is left for later
+                return "\\Af(?=(?:[[:xdigit:]]{2})+\\z)";
+            }
             RegexpTransformer transformer = new RegexpTransformer(rubyPattern);
             return transformer.Transform();
         }
@@ -141,11 +145,37 @@
             }
         }
 
+        private void OnOpenParanthesis() {
+            if (InEscapeSequence) {
+                AppendEscapedChar('(');
+            } else {
+                _sb.Append('(');
+                // Map (?imx-imx) to (?isx-isx) ie. (?m) should map to RegexOptions.SingleLine
+                if (HasMoreCharacters && NextCharacter == '?') {
+                    _index++;
+                    _sb.Append('?');
+                    while (HasMoreCharacters) {
+                        char n = NextCharacter;
+                        switch(n) {
+                            case 'm': _index++; _sb.Append('s'); break; // Map (?m) to (?s) ie. RegexOptions.SingleLine
+
+                            case 'i':
+                            case 'x':
+                            case '-': _index++; _sb.Append(n); break;
+
+                            default: return;
+                        }
+                    }
+                }
+            }
+        }
+
         private string/*!*/ Transform() {
             for (/**/; _index < _rubyPattern.Length; _index++) {
                 char c = _rubyPattern[_index];
                 switch (c) {
                     case '\\': OnBackSlash(); break;
+                    case '(': OnOpenParanthesis(); break;
                     case '[': OnOpenBracket(); break;
                     case ']': OnCloseBracket(); break;
                     default: OnChar(c); break;
===================================================================
edit: $/Merlin_External/Languages/IronRuby/mspec/rubyspec/language/regexp_spec.rb;C737451
File: regexp_spec.rb
===================================================================
--- $/Merlin_External/Languages/IronRuby/mspec/rubyspec/language/regexp_spec.rb;C737451  (server)    2/2/2009 1:42 PM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/mspec/rubyspec/language/regexp_spec.rb;re
@@ -97,6 +97,22 @@
     # \nnn         octal char            (encoded byte value)
   end
   
+  it 'supports meta-characters via escape sequence' do
+    /\\/.match("\\").to_a.should == ["\\"]
+    # brackets, paranthesis
+    /\(/.match("(").to_a.should == ["("]
+    /\)/.match(")").to_a.should == [")"]
+    /\[/.match("[").to_a.should == ["["]
+    /\]/.match("]").to_a.should == ["]"]
+    /\{/.match("{").to_a.should == ["{"]
+    /\}/.match("}").to_a.should == ["}"]
+    # quantifiers
+    /\./.match(".").to_a.should == ["."]
+    /\+/.match("+").to_a.should == ["+"]
+    /\?/.match("?").to_a.should == ["?"]
+    /\*/.match("*").to_a.should == ["*"]
+  end
+  
   it 'allows any character to be escaped' do
     /\y/.match("y").to_a.should == ["y"]  
   end
@@ -464,22 +480,64 @@
     /(?:xdigit:)/.match("xdigit:").to_a.should == ["xdigit:"]
   end
   
-  it 'supports (?imx-imx)' do
-    /foo(?i)bar/.match("fooBAR").to_a.should == ["fooBAR"]
-    /foo(?i)bar/.match("FOOBAR").should be_nil
-    /foo(?-i)bar/i.match("FOObar").to_a.should == ["FOObar"]
-    /foo(?-i)bar/i.match("fooBAR").should be_nil
+  it 'supports (?imx-imx) (inline modifiers)' do
+    /(?i)foo/.match("FOO").to_a.should == ["FOO"]
+    /foo(?i)/.match("FOO").should be_nil
+    # Interaction with /i
+    /(?-i)foo/i.match("FOO").should be_nil
+    /foo(?-i)/i.match("FOO").to_a.should == ["FOO"]
+    # Multiple uses
+    /foo (?i)bar (?-i)baz/.match("foo BAR baz").to_a.should == ["foo BAR baz"]
+    /foo (?i)bar (?-i)baz/.match("foo BAR BAZ").should be_nil
+    
+    /(?m)./.match("\n").to_a.should == ["\n"]
+    /.(?m)/.match("\n").should be_nil
+    # Interaction with /m
+    /(?-m)./m.match("\n").should be_nil
+    /.(?-m)/m.match("\n").to_a.should == ["\n"]
+    # Multiple uses
+    /. (?m). (?-m)./.match(". \n .").to_a.should == [". \n ."]
+    /. (?m). (?-m)./.match(". \n \n").should be_nil
+      
+    /(?x) foo /.match("foo").to_a.should == ["foo"]
+    / foo (?x)/.match("foo").should be_nil
+    # Interaction with /x
+    /(?-x) foo /x.match("foo").should be_nil
+    / foo (?-x)/x.match("foo").to_a.should == ["foo"]
+    # Multiple uses
+    /( foo )(?x)( bar )(?-x)( baz )/.match(" foo bar baz ").to_a.should == [" foo bar baz ", " foo ", "bar", " baz "]
+    /( foo )(?x)( bar )(?-x)( baz )/.match(" foo barbaz").should be_nil
+    
+    # Parsing
+    /(?i-i)foo/.match("FOO").should be_nil
+    /(?ii)foo/.match("FOO").to_a.should == ["FOO"]
+    /(?-)foo/.match("foo").to_a.should == ["foo"]
+    lambda { eval('/(?a)/') }.should raise_error(SyntaxError)
   end
   
-  it 'supports (?imx-imx:expr)' do
-    /foo(?i:bar)baz/.match("fooBARbaz").to_a.should == ["fooBARbaz"]
-    /foo(?i:bar)baz/.match("fooBARBAZ").should be_nil
-    /foo(?-i:bar)baz/i.match("FOObarBAZ").to_a.should == ["FOObarBAZ"]
-    /foo(?-i:bar)baz/i.match("fooBARbaz").should be_nil
+  it 'supports (?imx-imx:expr) (scoped inline modifiers)' do
+    /foo (?i:bar) baz/.match("foo BAR baz").to_a.should == ["foo BAR baz"]
+    /foo (?i:bar) baz/.match("foo BAR BAZ").should be_nil   
+    /foo (?-i:bar) baz/i.match("foo BAR BAZ").should be_nil
+
+    /. (?m:.) ./.match(". \n .").to_a.should == [". \n ."]
+    /. (?m:.) ./.match(". \n \n").should be_nil
+    /. (?-m:.) ./m.match("\n \n \n").should be_nil
+      
+    /( foo )(?x: bar )( baz )/.match(" foo bar baz ").to_a.should == [" foo bar baz ", " foo ", " baz "]
+    /( foo )(?x: bar )( baz )/.match(" foo barbaz").should be_nil
+    /( foo )(?-x: bar )( baz )/x.match("foo bar baz").to_a.should == ["foo bar baz", "foo", "baz"]
+    
+    # Parsing
+    /(?i-i:foo)/.match("FOO").should be_nil
+    /(?ii:foo)/.match("FOO").to_a.should == ["FOO"]
+    /(?-:)foo/.match("foo").to_a.should == ["foo"]
+    lambda { eval('/(?a:)/') }.should raise_error(SyntaxError)
   end
   
   it 'supports (?# )' do
     /foo(?#comment)bar/.match("foobar").to_a.should == ["foobar"]
+    /foo(?#)bar/.match("foobar").to_a.should == ["foobar"]
   end
   
   it 'supports \<n> (backreference to previous group match)' do
@@ -487,6 +545,12 @@
     /(foo.)\1/.match("foo1foo2").should be_nil
   end
   
+  not_compliant_on :ironruby do
+    it 'resets nested \<n> backreference before match of outer subexpression' do
+      /(a\1?){2}/.match("aaaa").to_a.should == ["aa", "a"]
+    end
+  end
+  
   #############################################################################
   # Modifiers
   #############################################################################
===================================================================
