guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexp-exec fails for long strings


From: rm
Subject: Re: regexp-exec fails for long strings
Date: Thu, 25 Apr 2002 23:47:13 +0200
User-agent: Mutt/1.3.24i

On Thu, Apr 25, 2002 at 01:05:50PM -0700, Thien-Thi Nguyen wrote:
>[...] 
> if someone can confirm similar behavior on another system (perhaps by
> varying the appended string length), i will add this to the bugs db.
> (i ask for this confirmation because my system's old sdrams are prone to
> mysterious failures, and i want to rule that out as a reason.)

Ok, this is on my rather 'old' guile-1.5 box (the guile-HEAD is at home):

|  guile> (version)
|  "1.5.0"
|  guile> (use-modules (ice-9 regex))
|  guile> 
|  guile> (define ok "<section_name>Projects List</section_name>")
|  guile> 
|  guile> (define rx (make-regexp "<section_name>(.*)</section_name>"))
|  guile> 
|  guile> (define (+space s n)
|  ...   (string-append s (make-string n #\space)))
|  guile> 
|  guile> (define (test s)
|  ...   (format #t "string-length ~A\t=> ~A\n"
|  ...           (string-length s)
|  ...           (if (regexp-exec rx s)
|  ...               "ok"
|  ...               "FAIL")))
|  guile> (test ok)
|  string-length 42     => ok
|  guile> (test (+space ok 11672))
|  string-length 11714  => ok
|  guile> (test (+space ok 11673))
|  string-length 11715  => ok
|  guile> (test (+space ok 11674))
|  string-length 11716  => FAIL
|  guile> (test (+space ok 11675))
|  string-length 11717  => FAIL
|  guile> (test (+space ok 11700))
|  string-length 11742  => FAIL
|  guile> 
|  

Hmmm, never really used guile's regex heavily - that's where i
still use <blush>perl</blush>.

  Ralf

> thi
> 
> ____________________________________________
> (use-modules (ice-9 regex))
> 
> (define ok "<section_name>Projects List</section_name>")
> 
> (define rx (make-regexp "<section_name>(.*)</section_name>"))
> 
> (define (+space s n)
>   (string-append s (make-string n #\space)))
> 
> (define (test s)
>   (format #t "string-length ~A\t=> ~A\n"
>           (string-length s)
>           (if (regexp-exec rx s)
>               "ok"
>               "FAIL")))
> 
> ;; do it
> (test ok)                               ; ok
> (test (+space ok 11672))                ; ok
> (test (+space ok 11673))                ; ok
> (test (+space ok 11674))                ; FAIL
> (test (+space ok 11675))                ; FAIL
> (test (+space ok 11700))                ; FAIL
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user



reply via email to

[Prev in Thread] Current Thread [Next in Thread]