on ‎2022 Dec 08 11:25 PM
Hi,
I've been facing an issue for quite a long time now, which I've always managed to bypass so far but it has become so critical it really blocks my project now. Let me explain:
I created a custom script containing a regular expression, the activity (#29) works well and generates a proper output (a 2 or 3 digit number):


However, each time I add another custom script right after an existing custom script (selecting the previous custom script output as input: what I'm trying to do here is to "clean" the previous custom script output in case it contains unwanted characters) and I run the automation, the second custom script results in the following error message "input.match is not a function" (note that both custom script activities have the same kind of function: return input.match(MyRegex);):


In the above screenshots, the first custom script is part of a Try/Catch Control, but even when not using a Try/Catch control, the second custom script always results in the same kind of error message "input.match is a not a function", whereas both regex work fine and each custom script performs well when "standing alone".
What am I missing here? Does anyone have a clue?
Thanks for your help.
Best regards,
LM.
Request clarification before answering.
Could not reproduce the issue with a simple example.
Can you try to have both calls in just one custom script ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi thomas.jentsch,
Thanks for your answer. Can you share your example please? Because I've also tried with a basic automation (2 consecutive custom scripts with return input.match(MyRegex); functions) and it still does not work on my side. I really don't see how I could do it any differently...
Thanks,
LM.
Guess come closer to the problem now.
I'm not an expert of regular expression, but seems that match() returns an array and not a string.
Here a sample with an empty regular expression:
If you want to return a string, you need to return the first element from the array.
And here you can add the second match() already.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.