Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple replacement doesn't works correctly with lookaround #179

Open
chenyulue opened this issue Dec 17, 2020 · 0 comments
Open

multiple replacement doesn't works correctly with lookaround #179

chenyulue opened this issue Dec 17, 2020 · 0 comments
Labels

Comments

@chenyulue
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants