Javascript pattern test on client input

I’m creating an Input element on client side and gave a pattern to an input in HTML,

it should prevent user inputs according to the given pattern,

it doesn’t work as I stated in the code below,

it returns true every time, it doesn’t test the regex pattern properly

init(params) {
        // ^(d{1,9}.d{1,3})|(.d{1,3})|(d{1,9})$
        // create the cell
        // <input class="" pattern="asdasd"/>
        debugger;
        this.eInput = document.createElement('input');
        this.eInput.className = 'ag-input-field-input ag-text-field-input';
        //var regex = /^(d{1,9}.d{1,3})|(.d{1,3})|(d{1,9})$/;
        this.eInput.setAttribute("pattern", "^(\d{1,9}\.\d{1,3})|(\.\d{1,3})|(\d{1,9})$");
        /* var a = regex.test(params.value);*/
        if (this.isCharNumeric(params.charPress)) {
            this.eInput.value = params.charPress;
        } else {
            if (params.value !== undefined && params.value !== null) {
                this.eInput.value = params.value;
            }
        }

        this.eInput.addEventListener('keypress', (event) => {
            var regex = new RegExp(/(d{1,3}.d{1,3})|(.d{1,3})|(d{1,3})/);

            if (!this.isKeyPressedNumeric(event)) {
                this.eInput.focus();
                if (event.preventDefault) event.preventDefault();
            } else if (this.isKeyPressedNavigation(event)) {
                event.stopPropagation();
            }

            if (event.target.value != "") {
                if (!regex.test(event.key)) {
                    console.log('FALSE INPUT');
                    this.eInput.focus();
                    if (event.preventDefault) event.preventDefault();
                } else {
                    console.log('VALID INPUT');
                }
            }
            
        });

        // only start edit if key pressed is a number, not a letter
        var charPressIsNotANumber =
            params.charPress && '1234567890'.indexOf(params.charPress) < 0;
        this.cancelBeforeStart = !!charPressIsNotANumber;
    }

I’ve tested other regex patterns that works normally, but none of them works in my case