Is the replace of JavaScript unable to parse complex regularities?

u.changIp = function(e){
        if (e.value = e.value.replace(/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?

    \\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/,"")) {
                return;
            }else {
                //
        }
    

verify whether the ip address is valid

The

code is like this, but it can not be verified successfully. After trying to create new RegExp (), it still seems to have no effect, but I use this method to verify that it will take effect when only numbers are allowed to be entered. The code for verifying input numbers: e.value = e.value.replace (/ DGG); however, putting this rule on the background can verify it successfully

.
 @Pattern(regexp="^$|((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)",message="")
    

what is the reason, please? No error is reported. It is the

bound to the oninput event.

related codes

   u.changeNub = function(e){
    //
            if (e.value = e.value.replace(/\D/g,"")) {
                return;
            }else {
                api.toast({
                    msg: "",
                    duration: 2000,
                    location: "bottom"
                });
            }
        }

//ip
if (e.value = e.value.replace(/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/,""))

what result do you expect? What is the error message actually seen?

Mar.15,2022

In

js, the single slash represents the translation of special characters, while \ d itself is a rule used to match numbers. \\ d represents the combination of the matching character \ and the English letter d
in the same way \. represents the matching symbol . , and the double slash represents the matching character \.

and your regularities can be simplified. The final regular should be
((?: (25 [0-5] | 2 [0-4]\ d | [01]?\ d?)\.)) {3}\ 2


you remove one of all\\


'='- >'='

Menu