Summary

irregex documentation example for irregex-search does not match implementation

Metadata

Attachments

Description

The docs for irregex-search imply that an case-insensitive search is possible by passing the symbol 'i as third argument. This seems to be wrong:

 #;1> (use irregex)
 #;2> (irregex-search "foobar" "abcFOOBARdef" 'i) 
 
 Error: (irregex-search) not an exact integer: i

This happened with

 ; csi
 
 CHICKEN
 (c) 2008-2013, The Chicken Team
 (c) 2000-2007, Felix L. Winkelmann
 Version 4.8.2 (rev 623c46b)
 openbsd-unix-gnu-x86 [ manyargs dload ptables ]
 compiled 2013-02-03 on necronomicon.my.domain (OpenBSD)

Changes and comments

[2013-02-17 12:59:08 UTC] ckeen wrote:

My uneducated guess is that this should read

 (irregex-search (irregex "foobar" 'i) "abcFOOBARdef")

[2013-11-12 20:55:06 UTC] sjamaan changed milestone from someday to 4.9.0

[2013-11-12 20:55:06 UTC] sjamaan wrote:

Let's do this for 4.9.0 too

[2013-11-15 08:42:48 UTC] evhan attached 0001-Fix-irregex-search-example-with-i-case-insensitive-o.patch (description=#f)

[2013-11-15 08:44:56 UTC] evhan wrote:

Replying to ckeen: > My uneducated guess is that this should read > > { > (irregex-search (irregex "foobar" 'i) "abcFOOBARdef") > }

I think that's right (and that's what's used in an example later in the docs, as well). I sent this change to Alex, so we can... Wait for that to be applied? Or just go ahead and change the docs, I dunno. Here's a patch for the manual either way.

[2013-11-15 21:02:35 UTC] sjamaan wrote:

Thanks Evan. I think we should wait and see what Alex says.

[2013-11-16 06:05:06 UTC] evhan changed status from new to closed

[2013-11-16 06:05:06 UTC] evhan set resolution to fixed

[2013-11-16 06:05:06 UTC] evhan wrote:

This change was accepted upstream. I also noticed another case where our docs don't match irregex proper's, which has the correct version:

 -(irregex-search '(: "match" (? "es") "!") "matche!") => #<match>
 +(irregex-search '(: "match" (? "es") "!") "matche!") => #f

Because these are trivial fixes, I've gone ahead and pushed them to the manual, so this can be closed.

I also noticed two cases where both our unit and irregex proper don't behave like the docs say they should: #1064 #1065