function validate($value, $regex = null)
    {
        if (isset($this->_data[$this->name])) {
            if (!preg_match($this->_data[$this->name], $value)) {
                return false;
            }
        } else {
            if (!preg_match($regex, $value)) {
                return false;
            }
        }
        return true;
    }
function validate($value, $regex = null)
    {
        if (isset($this->_data[$this->name])) {
            if (!preg_match($this->_data[$this->name], $value)) {
                return false;
            }
        } else {
            if (!preg_match($regex, $value)) {
                return false;
            }
        }
        return true;
    }
function validate ( $ value , $ regex = null ) { if ( isset ( $ this -> _data [ $ this -> name ] ) ) { if ( ! preg_match ( $ this -> _data [ $ this -> name ] , $ value ) ) { return false ; } } else { if ( ! preg_match ( $ regex , $ value ) ) { return false ; } } return true ; }
Validates a value using a regular expression

@param     string    $value      Value to be checked
@param     string    $regex      Regular expression
@access    public
@return    boolean   true if value is valid
Validates a value using a regular expression