regexp-matches mishandles partial optional match

Create issue
Issue #263 resolved
Göran Weinholt created an issue

Hello! The regexp-matches procedure from SRFI 115 seems to have a bug:

sash> (import (srfi :115))
#<unspecified>
sash> (regexp-matches (rx "1" (optional "x" "2")) "1x")
#<text-matcher #/1(?u:(?:x2)?)/u "1x">

As I understand the specification, this case should return #f. That’s because both the optional patterns must be present in the input for this to match. The reference implementation returns #f in this case.

Comments (2)

  1. Log in to comment