Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin-flow-builder: resolve regex in keywords #2797

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

Iru89
Copy link
Contributor

@Iru89 Iru89 commented Mar 18, 2024

Description

Being able to define keywords as regular expressions in the flow builder frontend, using the RegExp /pattern/flags format.

If the plugin detects that the keyword is a regular expression it will apply this in the user input, otherwise it will do the logic that was done until now to check if the exact word is in the user input.

Context

The keyword node until now could only pass words and what it checked was if the user input contained that word exactly as it was written, including upper and lower case.
With this new feature we can use regex to do pattern matching.

Approach taken / Explain the design

First it checks if the keyword is a regex if so it applies the regex on the user input. Otherwise it will do the logic that was done until now looking if the user input contains this word written as in the keyword node.

To document / Usage example

By using regex on a keyword you can capture inputs such as:

  • exact word /^word$/
  • 5 numbers in a row /\d{5}/

In the following image we can see a keyword node where there are two keywords the first one is the text country, if we only have this keyword it would only enter in the next node if the user input contains the word country in lowercase.
The second keyword is declared as a regex with the flag i which indicates that it will search case-insensitive.

Captura de pantalla 2024-03-18 a las 17 41 24

Copy link

linear bot commented Mar 18, 2024

@Iru89 Iru89 changed the title feat(plugin-flow-builder): resolve regexp in keywords plugin-flow-builder: resolve regexp in keywords Mar 18, 2024
@Iru89 Iru89 changed the title plugin-flow-builder: resolve regexp in keywords plugin-flow-builder: resolve regex in keywords Mar 18, 2024
Copy link
Contributor

@AlbertGom AlbertGom left a comment

Choose a reason for hiding this comment

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

👏

packages/botonic-plugin-flow-builder/src/api.ts Outdated Show resolved Hide resolved
@Iru89 Iru89 force-pushed the feature/blt-624-task-keywords-as-regexp branch from b87d901 to e57e078 Compare March 19, 2024 16:56
@Iru89 Iru89 force-pushed the feature/blt-611-task-add-custom-conditional-on-flow-builder-plugin branch from 19a7e4d to a1f9188 Compare March 20, 2024 14:37
Base automatically changed from feature/blt-611-task-add-custom-conditional-on-flow-builder-plugin to master-lts March 20, 2024 14:38
@pull-request-size pull-request-size bot added size/L and removed size/S labels Mar 20, 2024
@Iru89 Iru89 force-pushed the feature/blt-624-task-keywords-as-regexp branch from e57e078 to 78d71f3 Compare March 20, 2024 14:45
@pull-request-size pull-request-size bot added size/S and removed size/L labels Mar 20, 2024
@Iru89 Iru89 merged commit ca3e559 into master-lts Mar 20, 2024
1 check passed
@Iru89 Iru89 deleted the feature/blt-624-task-keywords-as-regexp branch March 20, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants