Skip to content

Conversation

@TheJoeFin
Copy link
Owner

No description provided.

Introduces a new menu option to extract regex patterns from text using Windows AI LanguageModel. Also includes code style improvements and modernizations in language detection logic. No breaking changes to existing features.
Separated character, numeric, file, and OCR utilities into their own classes for improved modularity and maintainability. Updated usages throughout EditTextWindow and related files. Improved error handling and WPF compatibility.
Enhanced regex pattern detection and explanation display for better usability and clarity.
@TheJoeFin TheJoeFin added enhancement New feature or request Edit Text Window Anything to do with the Edit Text Window or functions within it labels Jan 26, 2026
@TheJoeFin TheJoeFin changed the base branch from main to dev January 26, 2026 03:07
@TheJoeFin TheJoeFin requested a review from Copilot January 26, 2026 03:09
Copy link

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 a new "Extract RegEx" feature that uses Windows AI local LLM to generate regular expression patterns from text descriptions. It also refactors code by extracting utility methods from EditTextWindow into dedicated utility classes for better maintainability.

Changes:

  • Added new WindowsAiUtilities.ExtractRegex() method that generates regex patterns using local AI
  • Created three new utility classes (NumericUtilities, CharacterUtilities, IoUtilities) and moved helper methods from EditTextWindow to improve code organization
  • Added auto-detection feature in FindAndReplaceWindow that automatically enables regex mode when patterns start with ^ and end with $

Reviewed changes

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

Show a summary per file
File Description
Text-Grab/Views/EditTextWindow.xaml Added new "Extract RegEx" menu item to the AI submenu
Text-Grab/Views/EditTextWindow.xaml.cs Implemented ExtractRegexMenuItem_Click handler; refactored helper methods out to utility classes; minor code cleanup (null checks, namespace simplifications)
Text-Grab/Utilities/WindowsAiUtilities.cs Added ExtractRegex and CleanRegexResult methods for AI-powered regex generation; improved code formatting consistency
Text-Grab/Utilities/NumericUtilities.cs New utility class containing numeric helper methods (CalculateMedian, FormatNumber, AreClose) moved from EditTextWindow
Text-Grab/Utilities/CharacterUtilities.cs New utility class containing character analysis methods (GetUnicodeCategory, GetCharacterDetailsText, HTML entity helpers) moved from EditTextWindow
Text-Grab/Utilities/IoUtilities.cs Added ListFilesFoldersInDirectory method moved from EditTextWindow
Text-Grab/Utilities/OcrUtilities.cs Added OcrFile method moved from EditTextWindow
Text-Grab/Utilities/StringMethods.cs Added CountMatches and CountRegexMatches methods moved from EditTextWindow
Text-Grab/Utilities/WindowUtilities.cs Added GetScrollViewer method moved from EditTextWindow
Text-Grab/Controls/FindAndReplaceWindow.xaml.cs Added auto-detection for regex patterns with anchors (^$) that automatically enables regex mode

Refactor for consistency, readability, and modern C# usage.
Expanded test coverage for CleanRegexResult, added analysis report for filtering bug, made method public, and updated test dependencies.
Refined the prompt for generating regex patterns to be more direct and concise, emphasizing the return of only the regex pattern.
@TheJoeFin TheJoeFin merged commit 71685c6 into dev Jan 26, 2026
1 check passed
@TheJoeFin TheJoeFin deleted the gen-regex branch January 26, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Edit Text Window Anything to do with the Edit Text Window or functions within it enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants