Skip to content

Add replaceWithList and regexReplaceWithList filter functions#3213

Merged
sdottaka merged 3 commits intomasterfrom
feature/replace-with-list-functions
Feb 21, 2026
Merged

Add replaceWithList and regexReplaceWithList filter functions#3213
sdottaka merged 3 commits intomasterfrom
feature/replace-with-list-functions

Conversation

@sdottaka
Copy link
Member

@sdottaka sdottaka commented Feb 19, 2026

This PR adds replaceWithList and regexReplaceWithList functions to the filter engine.

  • Introduces list-based string and regex replacement using tab-separated files
  • Supports comments, empty lines, encoding detection, and environment variable expansion
  • Optimizes evaluation by preloading replacement lists and regex patterns
  • Improves regexreplace optimization by caching compiled regular expressions
  • Adds comprehensive unit tests and updates documentation

Copy link
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 PR adds two new filter functions (replaceWithList and regexReplaceWithList) to the WinMerge filter engine, enabling list-based string and regex replacements from tab-separated files.

Changes:

  • Introduces ReplaceList.h/cpp for loading replacement rules from files
  • Adds replaceWithList and regexReplaceWithList functions to the filter engine
  • Optimizes regexreplace by caching compiled regular expressions
  • Updates documentation across multiple languages

Reviewed changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Src/FilterEngine/ReplaceList.h New header declaring list loading functions
Src/FilterEngine/ReplaceList.cpp Implementation of list loading with encoding detection
Src/FilterEngine/FilterExpressionNodes.cpp New functions and optimization improvements
Testing/GoogleTest/FilterEngine/FilterExpression_test.cpp Comprehensive unit tests for new features
Docs/Manual/English/Filters.xml Documentation for new filter functions
Translations/Docs/Manual/*.po Updated translation files
Comments suppressed due to low confidence (2)

Src/FilterEngine/FilterExpressionNodes.cpp:1247

  • The unused variable 'replacements' should be removed from the ReplaceFunc function, as it's declared but never used.
	std::vector<std::pair<Poco::RegularExpression, std::string>> replacements;

Src/FilterEngine/ReplaceList.cpp:2

  • The file header comment is incomplete. It should include a brief description of what this file does.
/**
 */

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

@sdottaka sdottaka added this to the v2.16.55 milestone Feb 19, 2026
@sdottaka sdottaka marked this pull request as ready for review February 20, 2026 00:03
@sdottaka sdottaka merged commit fa62a73 into master Feb 21, 2026
4 checks passed
@sdottaka sdottaka deleted the feature/replace-with-list-functions branch February 21, 2026 09:33
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.

2 participants