<commit_before>define(['js/data/validator/Validator', 'underscore'], function (Validator, _) {

    return Validator.inherit('js.data.validator.RegExValidator', {
        defaults: {
            errorCode: 'regExError'
        },

        ctor: function(field, regEx){
            var b = this.callBase();

            if(!this.$.regEx){
                throw new Error("No regular expression defined!");
            }

            return b;
        },

        _generateCacheKey: function(field, regEx){
            return field + "_" + regEx.toString();
        },

        _validate: function (entity) {
            var value = entity.$[this.$.field];
            if(value && _.isString(value)){
                if(!this.$.regEx.test(value)){
                    return this._createFieldError();
                }
            }
            return true;
        }

    })
})
;<commit_msg>removed generate cache key ...<commit_after>define(['js/data/validator/Validator', 'underscore'], function (Validator, _) {

    return Validator.inherit('js.data.validator.RegExValidator', {
        defaults: {
            errorCode: 'regExError'
        },

        ctor: function(){
            var b = this.callBase();

            if(!this.$.regEx){
                throw new Error("No regular expression defined!");
            }

            return b;
        },

        _generateCacheKey: function(field, regEx){
            return null;
        },

        _validate: function (entity) {
            var value = entity.$[this.$.field];
            if(value && _.isString(value)){
                if(!this.$.regEx.test(value)){
                    return this._createFieldError();
                }
            }
            return true;
        }

    })
})
;
{'fraction_non_alphanumeric': 0.13473564525298465, 'fraction_numerical': 0.0, 'mean_word_length': 1.5142857142857142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '652159', 'n_tokens_mistral': 474, 'n_tokens_neox': 451, 'n_words': 88}