Skip to content

multiple replacement doesn't works correctly with lookaround #179

@chenyulue

Description

@chenyulue

Here is an example that doesn't works when importing Text.RE.PCRE.String.

I want to add commas , into a string of digits, separating it every three digits from right to left. The code snippet is as follows:

ghci> "12345678" *=~/ [ed|(?<=\d)(?=(\d\d\d)+$)///,|]
"12,345678"

ghci> "12345678" ?=~/ [ed|(?<=\d)(?=(\d\d\d)+$)///,|]
"12,345678"

Here (*=~/) works the same as (?=~/). For the multiple replacement, it should be "12,345,678".

More examples:

ghci> "1a2a3a" *=~/ [ed|(?=a)///,|]
"1,a2a3a"

ghci> "1a2a3a" *=~/ [ed|(?<=a)///,|]
"1a,2a3a"

This may be a bug. Please check it. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions