public function alphanum($value, $allowSpaces = false, $allowDashes = false)
    {
        $allowedCharsRegex = 'A-Za-z0-9';
        if ($allowSpaces) {
            $allowedCharsRegex .= ' ';
        }
        if ($allowDashes) {
            $allowedCharsRegex .= '\-';
        }

        return $this->notempty($value) && !preg_match('/[^' . $allowedCharsRegex . ']/', $value);
    }