I want to create a regular expression based on a user input from a search field. Using this regex, I want to filter a list of objects.
This one works:
However, I want to have a user defined search term, so I was trying this:
where the variable
regexis set to:
This leads to the following error:
bundle.js:23 Uncaught (in promise) TypeError: regex.test is not a function at callback (bundle.js:23) at bundle.js:28 at Proxy.map (<anonymous>) at bundle.js:26 at Object.onClick (bundle.js:34) at runHandler (sdk.js:14) at i.available.n.<computed> (sdk.js:14) at Object.ba (sdk.js:14) at ja (sdk.js:14) at ka (sdk.js:14)
I also noted that I can only connect raw text to “pattern/regexp” plug. That’s why I used raw text when defining
So, how to build a dynamic regex?