Answer Server 12.12

# getValidator

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

## Syntax

    getValidator( id )

## Arguments

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

## Returns

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.

## Examples

    taskUtils:getValidator("BAD_ID")

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.

© Copyright 2016-2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Answer Server 12.12

Topic Title: getValidator