Moodle  2.2.1
http://www.collinsharper.com
HTML_QuickForm_Rule_Regex Class Reference
Inheritance diagram for HTML_QuickForm_Rule_Regex:
Collaboration diagram for HTML_QuickForm_Rule_Regex:

Public Member Functions

 validate ($value, $regex=null)
 addData ($name, $pattern)
 getValidationScript ($options=null)

Data Fields

 $_data

Detailed Description

Validates values using regular expressions

Version:
1.0

Definition at line 27 of file Regex.php.


Member Function Documentation

addData ( name,
pattern 
)

Adds new regular expressions to the list

Parameters:
string$nameName of rule
string$patternRegular expression pattern public

Definition at line 75 of file Regex.php.

getValidationScript ( options = null)

Returns the javascript test (the test should return true if the value is INVALID)

Parameters:
mixedOptions for the rule public
Returns:
array first element is code to setup validation, second is the check itself

Reimplemented from HTML_QuickForm_Rule.

Definition at line 81 of file Regex.php.

validate ( value,
regex = null 
)

Validates a value using a regular expression

Parameters:
string$valueValue to be checked
string$regexRegular expression public
Returns:
boolean true if value is valid

Definition at line 54 of file Regex.php.


Field Documentation

$_data
Initial value:
 array(
                    'lettersonly'   => '/^[a-zA-Z]+$/',
                    'alphanumeric'  => '/^[a-zA-Z0-9]+$/',
                    'numeric'       => '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/',
                    'nopunctuation' => '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/',
                    'nonzero'       => '/^-?[1-9][0-9]*/'
                    )

Definition at line 38 of file Regex.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations