gerbil icon indicating copy to clipboard operation
gerbil copied to clipboard

:std/pregexp: produces invalid matches

Open yanndegat opened this issue 3 years ago • 3 comments

:std/pregexp seems to produce wrong matches

compared to racket regexp and pregexp, the same regular expresssion produces a wrong matches.

example here: the regexp is supposed to match urls and extract submatches.

the "user" match is wrong on gerbil for the first 2 urls

https://gist.github.com/yanndegat/3790c3ac97823fad7242ba589e3e8a17

the regexp definition is a copy/paste from https://github.com/racket/racket/blob/46a191df038244199f83f2bb1235beb8ca137f9a/racket/collects/net/url-string.rkt#L185

yanndegat avatar Mar 06 '21 19:03 yanndegat

The pregexp syntax is slightly different than racket's regexp syntax. Can you reduce it to a simple regexp that demonstrates the problem?

vyzo avatar Mar 08 '21 08:03 vyzo

hi @vyzo

The pregexp syntax is slightly different than racket's regexp syntax.

ok. but is :std/pregexp different from racket's "pregexp" ?

racket's pregexp seems to be the "perl" version of regexps. when i test this regexp with racket/regexp, racket/pregexp or a port to srfi-115, it seems to work properly

not with :std/pregexp

i'll try to see how i could simplify it by removing at least the last parts of the regexp

yanndegat avatar Mar 08 '21 13:03 yanndegat

It is Dorai Sitaram's pregexp package; see https://ds26gte.github.io/pregexp/index.html

vyzo avatar Sep 22 '23 11:09 vyzo