jackylee-ch opened a new pull request, #24987:
URL: https://github.com/apache/datafusion/pull/24987
## Which issue does this PR close?
- N/A
## Rationale for this change
`regexp_replace('foobarbaz', 'b..', 'X', '')` errors with `regex parse
error: (?)b` instead of returning `fooXbaz`. `regexp_count` and `regexp_instr`
accept an empty flags string through `compile_regex`, and so does Postgres.
`'gg'` hits the same error, since stripping `g` leaves an empty flags string.
## What changes are included in this PR?
Both call sites omit the `(?flags)` prefix when no flags remain after `g` is
stripped, matching `compile_regex` in the same module.
## What is the testing strategy for this PR?
Three queries in `regexp_replace.slt` and two unit tests in
`regexpreplace.rs`. All of them fail on `main` with `repetition operator
missing expression` and pass with this change.
## Are there any user-facing changes?
`regexp_replace` with an empty flags string now replaces instead of
erroring. No API change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]