diff --git a/r/src/compute.cpp b/r/src/compute.cpp index 994dc702e8e..c6ba0a28046 100644 --- a/r/src/compute.cpp +++ b/r/src/compute.cpp @@ -310,6 +310,11 @@ std::shared_ptr make_compute_options( max_replacements); } + if (func_name == "extract_regex") { + using Options = arrow::compute::ExtractRegexOptions; + return std::make_shared(cpp11::as_cpp(options["pattern"])); + } + if (func_name == "day_of_week") { using Options = arrow::compute::DayOfWeekOptions; bool one_based_numbering = true; diff --git a/r/tests/testthat/test-compute-no-bindings.R b/r/tests/testthat/test-compute-no-bindings.R index 30fb922d81c..f47ed12d4f8 100644 --- a/r/tests/testthat/test-compute-no-bindings.R +++ b/r/tests/testthat/test-compute-no-bindings.R @@ -177,3 +177,11 @@ test_that("non-bound compute kernels using MatchSubstringOptions", { c(0, 0, 1, 1) ) }) + +test_that("non-bound compute kernels using ExtractRegexOptions", { + skip_if_not_available("re2") + expect_equal( + call_function("extract_regex", Scalar$create("abracadabra"), options = list(pattern = "(?P[a])")), + Scalar$create(tibble::tibble(letter = "a")) + ) +})