Opened 11 years ago

Closed 11 years ago

#1065 closed defect (fixed)

irregex-match with `look-ahead` doesn't behave like the example in the docs

Reported by: evhan Owned by:
Priority: major Milestone: 4.9.0
Component: core libraries Version: 4.8.x
Keywords: irregex Cc:
Estimated difficulty:

Description

The docs for the irregex unit give the following example:

(irregex-match '(: "regular" (look-ahead " expression")) "regular expression") => #<match>

But that currently returns #f. This is true for irregex proper as well (tested with a handful of different Schemes).

Change History (2)

comment:1 Changed 11 years ago by sjamaan

Milestone: someday4.9.0

To be fixed before 4.9.0

comment:2 Changed 11 years ago by sjamaan

Resolution: fixed
Status: newclosed

This is actually correct, and not a bug: irregex-match returns a match only if the full string matches the regex (ie, the regex is implicitly anchored at the start and end). Your regex here does a lookahead on " expression", but does not actually consume that part.

If you use irregex-search, it'll return the expected value. So this is a documentation bug; I've fixed it upstream and added a few tests for positive/negative look-ahead and look-behind, just in case :)

Found a bug in the chunk handling of look-behind while working on these tests, so thanks for that!

Note: See TracTickets for help on using tickets.