Skip to content

Make replace and replaceWithList case-insensitive#3222

Merged
sdottaka merged 4 commits into
masterfrom
feature/case-insensitive-replace
Feb 24, 2026
Merged

Make replace and replaceWithList case-insensitive#3222
sdottaka merged 4 commits into
masterfrom
feature/case-insensitive-replace

Conversation

@sdottaka

Copy link
Copy Markdown
Member

Make replace and replaceWithList perform case-insensitive search and replacement.

@sdottaka sdottaka requested a review from Copilot February 24, 2026 11:33
@sdottaka sdottaka added this to the v2.16.55 milestone Feb 24, 2026
@sdottaka sdottaka marked this pull request as ready for review February 24, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request modifies the replace and replaceWithList filter expression functions to perform case-insensitive search and replacement. The changes convert string literals into pre-compiled regex patterns with the RE_CASELESS flag, enabling case-insensitive matching while preserving performance through optimization.

Changes:

  • Introduced escapeRegex helper function to escape special regex characters from literal strings
  • Modified replace function to use regex-based matching with case-insensitive flag
  • Updated replaceWithList and LoadList to pre-compile regex patterns for better performance
  • Enhanced FunctionNode::Optimize to pre-compile regex patterns at optimization time

Reviewed changes

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

File Description
Src/FilterEngine/ReplaceList.cpp Updated LoadList to compile regex patterns with RE_CASELESS flag for case-insensitive replacement
Src/FilterEngine/FilterExpressionNodes.cpp Added escapeRegex helper, modified ReplaceFunc and ReplaceWithListFunc to support case-insensitive regex matching, enhanced Optimize to pre-compile patterns

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

Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Outdated
Comment thread Src/FilterEngine/ReplaceList.cpp
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp Outdated
Comment thread Src/FilterEngine/FilterExpressionNodes.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

@sdottaka I've opened a new pull request, #3223, to work on those changes. Once the pull request is ready, I'll request review from you.

…nctions (#3223)

* Initial plan

* Add case-insensitive tests for replace and replaceWithList functions

Co-authored-by: sdottaka <98126+sdottaka@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sdottaka <98126+sdottaka@users.noreply.github.com>

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

@sdottaka I've opened a new pull request, #3224, to work on those changes. Once the pull request is ready, I'll request review from you.

… in lambda (#3224)

* Initial plan

* Fix lambda capturing local regex by reference: use shared_ptr by value

Co-authored-by: sdottaka <98126+sdottaka@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sdottaka <98126+sdottaka@users.noreply.github.com>
@sdottaka sdottaka merged commit ffcf960 into master Feb 24, 2026
2 of 3 checks passed
@sdottaka sdottaka deleted the feature/case-insensitive-replace branch February 24, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants