-1

I've got an existing app where users can enter regex expressions that they'd like to match against text to create a "trigger". Players can also add code to these triggers that will get executed when the trigger does match certain text.

As you can imagine, creating regexes is not a trivial thing and requires technical know-how. I'd like to lower the bar for this by engaging an AI (in this case, Petals). The basic idea is this: the user can give the AI a few example lines they'd like the trigger to match, and the AI will come up with a regex that does so.

How can I best integrate this into the existing editor, which looks like this?

enter image description here

The editor can also have a more expanded version with more advanced features available:

enter image description here

1
  • Do you plan to open a modal window for the user to interact with Petals? I'm thinking add a column with some sort of help icon, that when clicked opens Petals, and when closed inserts the regex into the field. Commented Dec 29, 2022 at 17:31

1 Answer 1

1

On the expanded version, add a section for regular expression builder, which is activated when the "perl regex" option next to the active text matching field is selected:

expanded version

builder

When the user enters multiple examples, and clicks the "Build regular expression" button, the regular expression is added to the currently active text matching field.

The examples can be refined and the regular expression rebuilt. Each time the "Build regular expression" is clicked the active text matching field is overwritten. And the field can still be manually edited. This allows the AI to get close and the user can make final touches.

 

Alternatively, if using a modal to build the regular expression, add a column with a help icon:

helper

Clicking the icon opens the modal. When the regular expression is built the user closes the modal and the regular expression is inserted into the text matching field.

Not the answer you're looking for? Browse other questions tagged or ask your own question.