[IronPython] Regexp issue, or not :)
Dino Viehland
dinov at exchange.microsoft.com
Wed Apr 19 16:50:39 CEST 2006
Yep, and this will be in beta 6. It was also reported to the www.gotdotnet.com bug database a while ago.
Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Wednesday, April 19, 2006 6:49 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Regexp issue, or not :)
2006/4/19, Albert Einstein <porkone at wp.pl>:
> 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 at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
More information about the Ironpython-users
mailing list