Skip to content

Greedy and Reluctant Quantifiers should not produce same match  #1

@nezda

Description

@nezda

This is behaving to the defined spec ("Greediness affects only submatches and never changes the whole match..."), but it doesn't match the "standard" behavior:

(= (re-find #".+" "AAA") "AAA") ;; same in seqexp
(= (re-find #".+?" "AAA") "A") ;; seqexp _+? would say "AAA"

Reluctant and non-reluctant return the same thing.

(se/exec (se/cat (se/+ 3)) [3 3 3 3]) ;; -> {:match (3 3 3 3), :rest nil}
(se/exec (se/cat (se/+? 3)) [3 3 3 3]) ;; -> {:match (3 3 3 3), :rest nil}
;; expected/wanted -> {:match (3), :rest (3 3 3)}

Maybe there is a small modification to support "traditional" reluctant quantifiers?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions