Skip to content

Conversation

@mitchcapper
Copy link

@mitchcapper mitchcapper commented Nov 27, 2025

Ok so this was my primary goal in seeking a regex project, to add an AI assist option. I generally find AI can be quite good at generating regex patterns but this should make it more automated by reducing the instructions a user must give.

This is a first attempt there is plenty of work to do (only one commit is different from the other PR but it is based on the other code base here is the ai specific changes: mitchcapper/RegExpress@improvements...ai_assist ).

This works with github copilot and in theory most other openAI endpoints but I have done limited testing there.

I am sure there are shortcuts I took here as well that should be resolved in terms of some of the data access. It stores several more things in the session state for the AI.

Overall used it for a few test projects and it has done well at quickly generating relevant regexes.

It also is missing some of the github copilot models (mostly addl alpha ones) and costing doesn't work yet. I am still working on those.

Again, understand if you don't want to add something big like this to the project as its too far off tangent, but I think it could be useful.

@mitchcapper
Copy link
Author

Here is an example of the AI assist in action. In the backend we already can tell the AI the users regex engine, the flags they have enabled, to prefer named capture groups if the language supports it etc.

This allows a user request like a regex to get the url and epoch from each row to generate what the user wants without them having to provide additional context. It generated the pattern you see in pattern in the screenshot and explained why it worked:

image

I figure we could also expand the AI pane to have an "explain regex" button that could breakdown the current regex the user has.

@mitchcapper
Copy link
Author

OK I moved most of this code now to an external repo. I know this project prefers to use standard event handlers / avoiding MVVM but I started to run into some issues staying that course, and the code base was growing. This creates a cleaner separation of the AI code base from the rest.

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.

1 participant