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

[R] perl operators in regular expressions #40220

Open
dhicks opened this issue Feb 23, 2024 · 1 comment
Open

[R] perl operators in regular expressions #40220

dhicks opened this issue Feb 23, 2024 · 1 comment

Comments

@dhicks
Copy link

dhicks commented Feb 23, 2024

Describe the enhancement requested

R 4.3, arrow 14.0.0.2 (most recent Mac OS binary; apologies in advance if this is already supported in source)

arrow can't handle perl operators, such as negative lookaheads, in regular expressions, at least via dplyr and stringr:

library(arrow)
library(dplyr)
library(stringr)

ar = data.frame(text = c('Lorem ipsum dolor sit amet', 
                         'Lorem dolor ipsum sit amet')) |> 
    as_arrow_table()

## Works, returns both rows
ar |> 
    filter(str_detect(text, 'Lorem [^(ipsum)]')) |> 
    collect()

## Should only return the second row
## Error in `compute.arrow_dplyr_query()`:
## ! Invalid: Invalid regular expression: invalid perl operator: (?!
ar |> 
    filter(str_detect(text, regex('Lorem(?! ipsum)')))
    collect()

Component(s)

R

@kou kou changed the title perl operators in regular expressions [R] perl operators in regular expressions Feb 24, 2024
@assignUser
Copy link
Member

Without looking at the code, so not a definitive answer, but I am pretty sure that re2 the C++ library used in acero doesn't support lookahead so this is probably not something that can be added.

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

No branches or pull requests

2 participants