The getValidator method returns a callable validator object. You can pass a string input to the validator object to validate some text.


getValidator( id )


Argument Description
id (string) The ID of the validator that you want to use.


A callable validator object, or nil if the parameter was not a valid validator ID.

When you pass a string to the validator object, it returns a normalized match if the input is valid, or nil if the input is not valid.



This example returns nil because the validator ID is not valid.

taskUtils:getValidator("NAME")("My name is Alice")

This example returns the normalized text Alice (assuming that NAME is the ID of a validator that matches common names).

taskUtils:getValidator("NAME")("I don't want to give my name") 

This example returns nil, because the text does not include any common names.