'Azdo custom task string input default value not to adhere reg exp validation

I'm creating a custom task and in the task.json I got this input:

{
    "name": "testUrl",
    "type": "string",
    "required": false,
    "label": "Test Url",
    "defaultValue": "",
    "visibleRule": "requiresTest = True",
    "validation": {
      "expression": "isMatch(value, '^https?:\/\/','IgnoreCase')",
      "message": "Supplied string must be an absoulte url only"
    }
  }

This input is optional and has a default value of an empty string. The problem is that if the user doesn't set it, the value of an empty string does not meet the requirement of the reg exp (which forces the input to be an absolute uri only , which is what I want). The task then fails because of that input.

Is there a way to have an initial value which won't be validated against the validation expression until the user try to edit it? I don't want to have a default value in a form of a url, but leave it an empty string.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source