2006/4/19, Albert Einstein <[EMAIL PROTECTED]>:
> m = re.compile("[a-z]+")
> p = m.match("sometext")
> p.group()
>
> Traceback (most recent call last):
> File , line 0, in input##44
> File , line 0, in group##15
> IndexError: Index was outside the bounds of the array.
>
> Is it bug in IronPython?

Yes it is. The documentation says:
http://docs.python.org/lib/match-objects.html

group([group1, ...])
Without arguments, group1 defaults to zero (the whole match is returned).

Here's a simple fix:

--- IronPython/Modules/re.cs.orig       2006-04-19 22:28:31.000000000 +0900
+++ IronPython/Modules/re.cs    2006-04-19 22:28:42.000000000 +0900
@@ -518,6 +518,11 @@
             }

             [PythonName("group")]
+            public object group() {
+                return m.Groups[0].Value;
+            }
+
+            [PythonName("group")]
             public object group(object index) {
                 return m.Groups[GetGroupIndex(index)].Value;
             }

Seo Sanghyeon
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to