src/jquery.validation.js
function (ruleObj) {

            if (!ruleObj.rule || (!ruleObj.regex && !ruleObj.message)) {
                // {debug}
                window.Debug.log({
                    'function': '$.alterValidationRules()',
                    'message': 'ERROR - Missing one or multiple parameter(s) {rule, regex, message}'
                });
                window.Debug.print();
                // {/debug}
                return false;
            }

            ruleObj.rule = ruleObj.rule.toUpperCase();

            if (ruleObj.regex) {

                var regex = _buildRegexFromString(ruleObj.regex);

                if (!(regex instanceof RegExp)) {
                    // {debug}
                    window.Debug.log({
                        'function': '$.alterValidationRules(rule)',
                        'arguments': regex.toString(),
                        'message': 'ERROR - Invalid rule'
                    });
                    window.Debug.print();
                    // {/debug}
                    return false;
                }

                _rules[ruleObj.rule] = regex;
            }

            if (ruleObj.message) {
                _messages[ruleObj.rule] = ruleObj.message;
            }

            return true;
        }
function (ruleObj) {

            if (!ruleObj.rule || (!ruleObj.regex && !ruleObj.message)) {
                // {debug}
                window.Debug.log({
                    'function': '$.alterValidationRules()',
                    'message': 'ERROR - Missing one or multiple parameter(s) {rule, regex, message}'
                });
                window.Debug.print();
                // {/debug}
                return false;
            }

            ruleObj.rule = ruleObj.rule.toUpperCase();

            if (ruleObj.regex) {

                var regex = _buildRegexFromString(ruleObj.regex);

                if (!(regex instanceof RegExp)) {
                    // {debug}
                    window.Debug.log({
                        'function': '$.alterValidationRules(rule)',
                        'arguments': regex.toString(),
                        'message': 'ERROR - Invalid rule'
                    });
                    window.Debug.print();
                    // {/debug}
                    return false;
                }

                _rules[ruleObj.rule] = regex;
            }

            if (ruleObj.message) {
                _messages[ruleObj.rule] = ruleObj.message;
            }

            return true;
        }
function ( ruleObj ) { if ( ! ruleObj . rule || ( ! ruleObj . regex && ! ruleObj . message ) ) { // {debug} window . Debug . log ( { 'function' : '$.alterValidationRules()' , 'message' : 'ERROR - Missing one or multiple parameter(s) {rule, regex, message}' } ) ; window . Debug . print ( ) ; // {/debug} return false ; } ruleObj . rule = ruleObj . rule . toUpperCase ( ) ; if ( ruleObj . regex ) { var regex = _buildRegexFromString ( ruleObj . regex ) ; if ( ! ( regex instanceof RegExp ) ) { // {debug} window . Debug . log ( { 'function' : '$.alterValidationRules(rule)' , 'arguments' : regex . toString ( ) , 'message' : 'ERROR - Invalid rule' } ) ; window . Debug . print ( ) ; // {/debug} return false ; } _rules [ ruleObj . rule ] = regex ; } if ( ruleObj . message ) { _messages [ ruleObj . rule ] = ruleObj . message ; } return true ; }
API method to add a validation rule.

@example
$.alterValidationRules({
rule: 'FILENAME',
regex: /^[^\\/:\*\?<>\|\"\']*$/,
message: '$ has an invalid filename.'
})

@param {Object} ruleObj
API method to add a validation rule .