Menu

#5 nregex from ai archve has a bug

closed
5
2012-09-14
2001-09-12
Anonymous
No

Hi,
I noticed you use nregex from the AI archives.
This contains a bug. I reported it to the author
but apparently it is still in there, so it
might be in your port too (I did not try).

The original bugreport to the author:

CL-USER 47 > (regex:regex "hal?o" (format nil "hallo"))
NIL ; correct

CL-USER 48 > (regex:regex "hal?o" (format nil "halo"))
("halo") ; correct

CL-USER 49 > (regex:regex "hal?o" (format nil "hao"))
NIL ; WRONG!! Should match

The problem is the test for special operators in the
processing of
a multicharacter literal. You forgot about the ?'. In fact you forgot about the{' too, but I saw this operator wasn't
implemented, so
I did not add it to this patch.
A unix type diff of the code:

diff -r1.4 nregex.lisp
321c321,322
< ;; is an astrisk or a plus. If so then
we must not use this


> ;; is an astrisk or a plus or a question
mark.
> ;; If so then we must not use this
324c325,327
< (if (or (eql term #*) (eql term #+))


> (if (or (eql term #*)
> (eql term #+)
> (eql term #\?))

I'll append the version as I am using it. It has a
modified regex macro you might like.

Discussion

  • Nobody/Anonymous

    modified nregex.lisp

     
  • Leon Roos van Raadshooven

    Logged In: YES
    user_id=231175

    Mmm, I forgot to identify myself:
    L.A.RoosvRaadshooven@kpn.com or leonrvr@planet.nl.

    Note: my browser broke the lines in the patch, but I cant
    fix it from here. Look in the attached file for the right lines.

     

Log in to post a comment.