Answer Server 25.3
Answer Server Help

# 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-2025 Open Text
Version 25.3 | Last updated July 2025

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Answer Server 25.3

Topic Title: getValidator