Skip to content

[Backport] CXXCBC-829: Replace std::regex_search with utils::contains_string#955

Open
thejcfactor wants to merge 1 commit into
couchbase:release-1.3from
thejcfactor:CXXCBC-829-backport
Open

[Backport] CXXCBC-829: Replace std::regex_search with utils::contains_string#955
thejcfactor wants to merge 1 commit into
couchbase:release-1.3from
thejcfactor:CXXCBC-829-backport

Conversation

@thejcfactor
Copy link
Copy Markdown
Contributor

Changes

  • Add contains_string(input, substr, ignore_case = false) substirng match with optional ASCII-only case folding, no std::locale dependency
  • Replace remaining std::regex_search calls with utils::contains_string()
  • Add unit tests to confirm contains_string() functionality

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This backport introduces a lightweight substring helper (core::utils::contains_string) to replace several std::regex_search-based error-message pattern checks (notably around Query index error mapping), avoiding std::locale dependencies and reducing regex usage in core error handling.

Changes:

  • Add core::utils::contains_string(input, substr, ignore_case) with ASCII-only case folding.
  • Replace several std::regex_search checks in query/management error handling with contains_string().
  • Add unit tests for contains_string() and wire them into the test build.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/utils/contains_string.hxx Declares the new substring helper API.
core/utils/contains_string.cxx Implements ASCII-only case-insensitive substring search.
core/operations/document_query.cxx Replaces regex-based query error message checks with contains_string().
core/operations/management/error_utils.cxx Replaces regex-based query error translation checks with contains_string().
core/operations/management/query_index_create.cxx Replaces regex-based “index already exists” detection with contains_string().
core/operations/management/query_index_drop.cxx Replaces regex-based “index not found” detection with contains_string().
test/test_unit_contains_string.cxx Adds unit tests covering empty inputs, case sensitivity, ASCII-only folding, and query-pattern scenarios.
test/CMakeLists.txt Registers the new contains_string unit test target.
CMakeLists.txt Adds core/utils/contains_string.cxx to the library build sources.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/operations/management/error_utils.cxx Outdated
Comment thread test/test_unit_contains_string.cxx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread core/operations/management/error_utils.cxx
Comment thread core/utils/contains_string.cxx
Comment thread core/operations/management/error_utils.cxx Outdated
…_string

Changes
-------
* Add `contains_string(input, substr, ignore_case = false)` substirng
  match with optional ASCII-only case folding, no `std::locale` dependency
* Replace remaining `std::regex_search` calls with
  utils::contains_string()
* Add unit tests to confirm `contains_string()` functionality
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants