diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2009-08-10 20:24:21 +0400 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2009-08-10 20:24:21 +0400 |
commit | 88c39f81b9bddbd3e1a8309b94c945526e36ba77 (patch) | |
tree | 111e45b23b3cedad17ab562808b289cbf4323263 /mcs/class | |
parent | 05672500d531784b3fb86d27310ad294f906c95e (diff) |
Regex.IsMatch("abcab", @"(?<ab>ab)c\1")
* System.Text.RegularExpressions/parser.cs (ResolveReferences):
Allow named groups to be referred-to by their group numbers too.
* RegexMatchTests.cs (RegexTrial0053): New.
svn path=/trunk/mcs/; revision=139655
Diffstat (limited to 'mcs/class')
4 files changed, 16 insertions, 0 deletions
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog index aea82d787f5..79707d381bf 100644 --- a/mcs/class/System/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,8 @@ +2009-08-10 Raja R Harinath <harinath@hurrynot.org> + + * parser.cs (ResolveReferences): Allow named groups to be + referred-to by their group numbers too. + 2009-04-23 Sebastien Pouliot <sebastien@ximian.com> * Regex.cs: Remove Compiler-related support for NET_2_1 diff --git a/mcs/class/System/System.Text.RegularExpressions/parser.cs b/mcs/class/System/System.Text.RegularExpressions/parser.cs index f3ddf196730..7cf261deb4f 100644 --- a/mcs/class/System/System.Text.RegularExpressions/parser.cs +++ b/mcs/class/System/System.Text.RegularExpressions/parser.cs @@ -1080,7 +1080,10 @@ namespace System.Text.RegularExpressions.Syntax { foreach (CapturingGroup group in caps) { if (group.Name != null) { if (!dict.Contains (group.Name)) { + string gid_s = gid.ToString (); dict.Add (group.Name, group); + if (!dict.Contains (gid_s)) + dict.Add (gid_s, group); group.Number = gid ++; ++ num_groups; diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog index 7ae8f624c85..877ff8241cd 100644 --- a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,7 @@ +2009-08-10 Raja R Harinath <harinath@hurrynot.org> + + * RegexMatchTests.cs (RegexTrial0053): New. + 2009-02-27 Jonathan Pryor <jpryor@novell.com> * RegexReplace.cs: Add null argument checks for Regex.Replace(). diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/RegexMatchTests.cs b/mcs/class/System/Test/System.Text.RegularExpressions/RegexMatchTests.cs index fa60eb67e3a..53a00f80442 100644 --- a/mcs/class/System/Test/System.Text.RegularExpressions/RegexMatchTests.cs +++ b/mcs/class/System/Test/System.Text.RegularExpressions/RegexMatchTests.cs @@ -148,6 +148,8 @@ namespace MonoTests.System.Text.RegularExpressions new RegexTrial (@"abc*(?!c{1,})", RegexOptions.None, "abcc", "Pass. Group[0]=(0,4)"),//50 new RegexTrial (@"(a)(?<1>b)(?'1'c)", RegexOptions.ExplicitCapture, "abc", "Pass. Group[0]=(0,3) Group[1]=(1,1)(2,1)"),//51 new RegexTrial (@"(?>a*).", RegexOptions.ExplicitCapture, "aaaa", "Fail."),//52 + + new RegexTrial (@"(?<ab>ab)c\1", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,5) Group[1]=(0,2)"),//53 }; [Test] @@ -318,5 +320,7 @@ namespace MonoTests.System.Text.RegularExpressions [Test] public void RegexJvmTrial0050 () { trials [50].Execute (); } [Test] public void RegexJvmTrial0051 () { trials [51].Execute (); } [Test] public void RegexJvmTrial0052 () { trials [52].Execute (); } + + [Test] public void RegexTrial0053 () { trials [53].Execute (); } } } |