(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular-ru/cdk/utils')) :
    typeof define === 'function' && define.amd ? define('@angular-ru/cdk/regexp', ['exports', '@angular-ru/cdk/utils'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['angular-ru'] = global['angular-ru'] || {}, global['angular-ru'].cdk = global['angular-ru'].cdk || {}, global['angular-ru'].cdk.regexp = {}), global['angular-ru'].cdk.utils));
}(this, (function (exports, utils) { 'use strict';

    var REG_EXP_STRICT_NAME = /^[a-z,A-Z,_]{1}[a-z,A-Z,0-9,_,]*$/;
    var REG_EXP_NO_CYRILLIC = /[^а-я,А-Я]+/g;
    var REG_EXP_DIGITS_SEPARATED_BY_COMMA = /[0-9]+(,[0-9]+)*,?/g;
    var REG_EXP_DIGITS = /[0-9]*/g;
    var REG_EXP_CREDIT_CARD_NUMBER_WITH_SEPARATOR = /^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}$/g;

    function ensureRegexp(regexp) {
        var prepared = regexp.charAt(0) === '/' ? regexp.slice(1) : regexp;
        prepared = prepared.charAt(prepared.length - 1) === '/' ? prepared.slice(0, prepared.length - 1) : prepared;
        return prepared;
    }

    var MIN_SIZE_REGEXP = 2;
    function isRegexpStr(value) {
        var _a;
        return (((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > MIN_SIZE_REGEXP && (value === null || value === void 0 ? void 0 : value.charAt(0)) === '/' && (value === null || value === void 0 ? void 0 : value.charAt((value === null || value === void 0 ? void 0 : value.length) - 1)) === '/');
    }

    function matchedByRegExp(regexp, value) {
        var _a;
        var matcher = regexp instanceof RegExp ? regexp : new RegExp(ensureRegexp(regexp), 'ig');
        return utils.isNotNil((_a = value.match(matcher)) === null || _a === void 0 ? void 0 : _a[0]);
    }

    /**
     * Generated bundle index. Do not edit.
     */

    exports.REG_EXP_CREDIT_CARD_NUMBER_WITH_SEPARATOR = REG_EXP_CREDIT_CARD_NUMBER_WITH_SEPARATOR;
    exports.REG_EXP_DIGITS = REG_EXP_DIGITS;
    exports.REG_EXP_DIGITS_SEPARATED_BY_COMMA = REG_EXP_DIGITS_SEPARATED_BY_COMMA;
    exports.REG_EXP_NO_CYRILLIC = REG_EXP_NO_CYRILLIC;
    exports.REG_EXP_STRICT_NAME = REG_EXP_STRICT_NAME;
    exports.ensureRegexp = ensureRegexp;
    exports.isRegexpStr = isRegexpStr;
    exports.matchedByRegExp = matchedByRegExp;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=angular-ru-cdk-regexp.umd.js.map
