diff --git a/cpp/src/strings/regex/regex.inl b/cpp/src/strings/regex/regex.inl index bc0679993d0..52cc69c69b8 100644 --- a/cpp/src/strings/regex/regex.inl +++ b/cpp/src/strings/regex/regex.inl @@ -276,10 +276,7 @@ __device__ inline int32_t reprog_device::regexec( } break; case EOL: - if (last_character || - (c == '\n' && (inst->u1.c == '$' || - // edge case where \n appears at the end of the string - pos + 1 == dstr.length()))) { + if (last_character || (c == '\n' && inst->u1.c == '$')) { id_activate = inst->u2.next_id; expanded = true; } diff --git a/cpp/tests/strings/contains_tests.cpp b/cpp/tests/strings/contains_tests.cpp index 229f9e4cc82..6f3896d7292 100644 --- a/cpp/tests/strings/contains_tests.cpp +++ b/cpp/tests/strings/contains_tests.cpp @@ -310,21 +310,21 @@ TEST_F(StringsContainsTests, MultiLine) auto expected_contains = cudf::test::fixed_width_column_wrapper({1, 1, 1, 0, 1}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_contains); results = cudf::strings::contains_re(view, "^abc$"); - expected_contains = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 1}); + expected_contains = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 0}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_contains); results = cudf::strings::matches_re(view, "^abc$", cudf::strings::regex_flags::MULTILINE); auto expected_matches = cudf::test::fixed_width_column_wrapper({1, 0, 1, 0, 1}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_matches); results = cudf::strings::matches_re(view, "^abc$"); - expected_matches = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 1}); + expected_matches = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 0}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_matches); results = cudf::strings::count_re(view, "^abc$", cudf::strings::regex_flags::MULTILINE); auto expected_count = cudf::test::fixed_width_column_wrapper({2, 1, 1, 0, 1}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_count); results = cudf::strings::count_re(view, "^abc$"); - expected_count = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 1}); + expected_count = cudf::test::fixed_width_column_wrapper({0, 0, 1, 0, 0}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected_count); } diff --git a/python/cudf/cudf/tests/test_string.py b/python/cudf/cudf/tests/test_string.py index cf52c4684c8..cc7be02a024 100644 --- a/python/cudf/cudf/tests/test_string.py +++ b/python/cudf/cudf/tests/test_string.py @@ -1746,7 +1746,7 @@ def test_string_wrap(data, width): ["A B", "1.5", "3,000"], ["23", "³", "⅕", ""], [" ", "\t\r\n ", ""], - ["$", "B", "Aab$", "$$ca", "C$B$", "cat", "cat\n"], + ["$", "B", "Aab$", "$$ca", "C$B$", "cat", "cat\ndog"], ["line\nto be wrapped", "another\nline\nto be wrapped"], ], )