Why are the regular expressions the same, but the order is different, but the result of the check is different?

requirements are either positive integers or positive floating point numbers
xixi and are written in a different order

clipboard.png
haha xixi

clipboard.png

clipboard.png

here is the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <title></title>
</head>
<body>
    <div class="container">
        <span>
            :
        </span>
        <div class="select_wrapper" style="display:inline-block;">
            <select name="reg" onchange="change()">
                <option value=""></option>
            </select>
        </div>
        <div>
            <span class="select_reg"></span>:
            <input type="text" class="tagret_str">
            <button class="btn" onclick="doReg()"></button>
            <p class="result">

</div> </div> <script> var RegExps = { xixi:/^([1-9]\d*\.\d+)|(0\.\d*[1-9]\d*)|([1-9]\d*)$/ , haha:/^([1-9]\d*)|([1-9]\d*\.\d+)|(0\.\d*[1-9]\d*)$/ }; var selectRegs = { xixi:"", haha:"haha" } function doReg(){ var tagret_str = $(".tagret_str").val(); var reg = RegExps[$("select").val()]; if(reg.test(tagret_str)){ $(".result").text("yes!").css("color","green"); }else{ $(".result").text("No!").css("color","red"); } } function change(){ var reg = RegExps[$("select").val()]; $(".select_reg").text(reg); } $(function(){ for(var key in selectRegs){ var optionHtml = `<option value="${key}">${selectRegs[key]}</option>`; $(".select_wrapper").find("select").append(optionHtml); } }) </script> </body> </html>
Oct.11,2021

^ and $can be removed. Does this cause the regularity to be different


regular writing is wrong and ugly: / ^\ d + (\.\ d +)? $/

here there must be a number around the decimal point, but the number is not required. Replace + with *

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4156b-2c569.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4156b-2c569.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?