Just to note the note on using mathjs functions in Script
you drop the math prefix, so using math.add is just add, so to use the filter function is just filter(x,
test)

I haven't had much luck with it myself, it does requires an array or matrix, maybe with the list types introduced that is possible. And then passing a valid regular expression through I can see being problematic, maybe a separate dynamic variable with escaped characters where appropriate
If it is an input, it might be easier to do that in the preceding flows, or pre-call rules, Do you have an example of what you are trying to filter? And what you tried with the ifElse Robert suggested.
edit: If you are just trying to see if a value is in a list, you could just use indexOf(). If the value is anything but -1 then it exists, if it is -1 then its not present.

------------------------------
Anton Vroon
------------------------------
Original Message:
Sent: 10-20-2022 18:36
From: Josue Garcia
Subject: How match an string using Regular Expression into Script
Hi Robert Wakefield-Carl,
I checked with ifElse and the result is not the expected. What did you experiment with math.js filter? did you have good results?
I opened this thread buecase I opened very days ago a ticket in order to get a solution of this, but they are not answer me for solution :(
Regards
------------------------------
Josue Garcia
Evolutio Cloud Enabler, S.A.
Original Message:
Sent: 10-06-2022 19:53
From: Robert Wakefield-Carl
Subject: How match an string using Regular Expression into Script
I have experimented with the math.filter stuff, but I would suggest you use the Equal or IfElse found on this page: Additional functions to use in dynamic variables - Genesys Cloud Resource Center (mypurecloud.com). Many times, Genesys will support only a part of a standard like Markup and probably the MathJS stuff. If you find something not working that should, consider opening a support ticket or submitting an Idea.
------------------------------
Robert Wakefield-Carl
Avtex Solutions, LLC
Contact Center Innovation Architect
https://www.Avtex.com
https://RobertWC.Blogspot.com
Original Message:
Sent: 09-30-2022 22:40
From: Josue Garcia
Subject: How match an string using Regular Expression into Script
Hi Everyone,
I'm working with a script and we have some problems to validate a value entered using 'Input script' element.
Accordng documentation we could use Mathjs functions using dynamic variables, however I was unable to run the function i believe it works in order to match an string using Regular Expressions.
Mathjs function i believe it should works for me is math.filter.
This function should works, according the documentation like this:
math.filter(x, test)
Where 'x' is the string entered into 'input element' and i want to evaluate and 'test' is the regular Expression i want apply to 'x' in order to validate.
I tried anything but it didn't work.
Could someone give me a tip, please?
Thanks in advance.
Regards
#ConversationalAI(Bots,AgentAssist,etc.)
------------------------------
Josue Garcia
Evolutio Cloud Enabler, S.A.
------------------------------