How to validate a website field, zipcode field, phone number field, in a script task

I am using IFS Cloud, which uses the Camunda platform 7 for it’s workflows.

I am trying to validate a custom field I created in IFS Cloud for the CustomerInfo entity. This field should store the customer’s website that we enter manually. The only issue is checking if the entered value is valid or not. I am creating a workflow to check if the entered value is a valid website or not and if it’s not, throw an error to the user.

How can I achieve this? I’ve tried using script tasks to handle the website validation by using Boolean(new URL(varInputWebsite)) but Camunda/IFS doesn’t recognize the new URL call.

I’ve tried using a const regex value to handle this but Camunda/IFS doesn’t like const’s it throws and error saying const const as if I’m defining this as a const twice, but when I remove my const it throws the same error.

How do I go about doing this when I don’t know what Camunda/IFS accepts and doesn’t accept from Javascript? All I need is an inline javascript script task that checks if a URL is valid or not. Any and all input would be greatly appreciated.