Skip to content

Registers in repetitions are not returned #25

@phmarek

Description

@phmarek

Using 35c5266, I can see that registers within repetitions are not correctly returned:

(cl-ppcre:scan-to-strings "(?:\\s+(\\w+)=(\\w+))*" " a1=A13 a2=A2 ")
" a1=A13 a2=A2"
#("a2" "A2")

I would have expected either an array with 4 strings, or an array with two arrays (or lists) in it.
SCAN, REGEX-REPLACE, REGEX-REPLACE-ALL are all messed up by that, too, of course.

BTW, how is REGEX-REPLACE-ALL supposed to be used with repetitions? When having a pattern ^A(B)*$, the replacement lambda only gets called once (and has to return the complete new string), so it doesn't really provide any advantage over using SCAN.
So, in order to be able to return new strings for each of the B matches (individually) I have to match the A first, and then call again with :START for the Bs; there's no easier way, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions