-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-11513: [R] Bindings for sub/gsub #9878
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
Conversation
| if (ignore.case) { | ||
| if (fixed) { | ||
| pattern <- gsub("\\E", "\\e", pattern, fixed = TRUE) | ||
| pattern <- paste0("(?i)\\Q", pattern, "\\E") | ||
| replacement <- gsub("\\", "\\\\", replacement, fixed = TRUE) | ||
| } else { | ||
| pattern <- paste0("(?i)", pattern) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maartenbreddels since ARROW-10306 did not directly support case-insensitive fixed string replacement (non-regex), this is the workaround we used to support this in the R bindings. Feedback welcome, and thanks for your work on the underlying C++ code!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments added explaining this code in db828be
nealrichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking close, just a few more questions
nealrichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, nice work! Will merge when CI is green-ish.
Also `stringr::str_replace()` and `stringr::str_replace_all()` Closes apache#9878 from ianmcook/ARROW-11513 Lead-authored-by: Ian Cook <ianmcook@gmail.com> Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
Also
stringr::str_replace()andstringr::str_replace_all()