Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin-flow-builder: resolve regex in keywords (#2797)
## 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](https://github.com/hubtype/botonic/assets/36898236/bad2b931-1f4d-4258-8d30-6663537932a7)
- Loading branch information