## Apache Zeta Components Manual :: Docs For Class ezcConsoleQuestionDialogRegexValidator

### ConsoleTools::ezcConsoleQuestionDialogRegexValidator

### Class ezcConsoleQuestionDialogRegexValidator

Regex validator for ezcConsoleQuestionDialog Validator class for ezcConsoleQuestionDialog objects that validates by matching a certain regular expression.

Source for this file: /ConsoleTools/src/dialog/validators/question_dialog_regex.php

### Implements interfaces:

- ezcConsoleQuestionDialogValidator

Version: | //autogen//

### Properties

mixed | read/write | `$default` A default value if no (an empty string) result given.
string | read/write | `$pattern` The pattern to use for validation. Delimiters and modifiers included.

### Member Variables

protected array(string=>mixed) | `$properties = array( "pattern" => null, "default" => null, )` Properties

### Method Summary

public void | `__construct( $pattern , [ $default = null] )` Create a new question dialog regex validator.
public mixed | `fixup( $result )` Returns a fixed version of the result, if possible.
public string | `getResultString( )` Returns a string representing valid results.
public bool | `validate( $result )` Returns if the given result is valid.

### Methods

#### __construct

void __construct( string $pattern , [mixed $default = null] )

Create a new question dialog regex validator.

Create a new question dialog regex validator, which validates the result specified against a given regular expression. The delimiters and eventual modifiers must be included in the pattern. If not value is provided by the user a possibly set $default value is used instead.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$pattern` | string | Pattern to validate against.
`$default` | mixed | Default value.

#### fixup

mixed fixup( mixed $result )

Returns a fixed version of the result, if possible.

If no result was provided by the user, the default value will be returned, if set.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$result` | mixed | The received result.

##### Implementation of:

Method | Description
--- | ---
`ezcConsoleDialogValidator::fixup()` | Returns a fixed version of the result, if possible.

#### getResultString

string getResultString( )

Returns a string representing valid results.

Returns the string that will be displayed with the question to indicate valid results to the user and a possibly set default, if available.

##### Implementation of:

Method | Description
--- | ---
`ezcConsoleQuestionDialogValidator::getResultString()` | Returns a string of possible results to be displayed with the question.

#### validate

bool validate( mixed $result )

Returns if the given result is valid.

Returns if the result matches the regular expression.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$result` | mixed | The received result.

##### Implementation of:

Method | Description
--- | ---
`ezcConsoleDialogValidator::validate()` | Returns if the given result is valid.

Documentation generated by phpDocumentor 1.4.3