[racket-dev] no capturing groups in regexp-split? [was Re: [PATCH] add regexp-split]

From: Marijn (hkBst at gentoo.org)
Date: Thu Dec 29 05:27:33 EST 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

this just appeared on guile-devel, but it seems to have exposed a bug
in racket.

On 29-12-11 10:32, Nala Ginrut wrote:
> hi guilers! It seems like there's no "regexp-split" procedure in
> Guile. What we have is "string-split" which accepted Char only. So
> I wrote one for myself.
> 
> ------python code-----
>>>> import re re.split("([^0-9])", "123+456*/")
> [’123’, ’+’, ’456’, ’*’, ’’, ’/’, ’’] --------code end-------
> 
> The Guile version:
> 
> ----------guile code------- (regexp-split "([^0-9])"  "123+456*/") 
> ==>("123" "+" "456" "*" "" "/" "") ----------code end--------
> 
> Anyone interested in it?

Welcome to Racket v5.2.0.7.
> (regexp-split "([^0-9])"  "123+456*/")
'("123" "456" "" "")

should it be considered a bug in racket that it doesn't support
capturing groups in regexp-split? Without the capturing group the
results are identical:

>>> import re re.split("[^0-9]", "123+456*/")
['123', '456', '', '']

> (regexp-split "[^0-9]"  "123+456*/")
'("123" "456" "" "")

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk78QJUACgkQp/VmCx0OL2xi1ACgu2CbR7PPti7KZVkqAHvW9Cep
VO0AnAm0fWP+q6BH/zcqOd3TuaSEiarN
=xuUl
-----END PGP SIGNATURE-----


Posted on the dev mailing list.