{"id":258264,"date":"2022-12-26T08:14:36","date_gmt":"2022-12-26T00:14:36","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=258264"},"modified":"2022-11-29T10:15:14","modified_gmt":"2022-11-29T02:15:14","slug":"hunger-linux-number","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/hunger-linux-number.html","title":{"rendered":"\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d0-10\u7684\u6b63\u6574\u6570\u4ee5\u53ca\u4f7f\u7528\u7ec6\u8282\u8be6\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u4ee3\u8868\u4e00\u4e9b\u6211\u4eec\u5e0c\u671b\u7684\u5b57\u7b26\u4e32\u7c7b\u578b,\u6bd4\u5982\u6b63\u6574\u6570,\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e86\u5173\u4e8e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d0-10\u7684\u6b63\u6574\u6570\u4ee5\u53ca\u4f7f\u7528\u7ec6\u8282\u7684\u76f8\u5173\u8d44\u6599,\u6587\u4e2d\u901a\u8fc7\u5b9e\u4f8b\u4ee3\u7801\u4ecb\u7ecd\u7684\u975e\u5e38\u8be6\u7ec6,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u6ce8\uff1a\u5982\u5acc\u7e41\u7410\uff1b\u5b9e\u73b0\u65b9\u6cd5\u53ef\u76f4\u63a5\u770b\u4e00\u3001\u5b9e\u73b0\u65b9\u6cd5\uff1b\u4f7f\u7528\u7ec6\u8282\u53ef\u76f4\u63a5\u770b \u4e09\u3001\u603b\u7ed3<\/p>\n

\u4e00\u3001\u5b9e\u73b0\u65b9\u6cd5<\/strong><\/div>\n

\u6cd5\u4e00\uff1a<\/p>\n

let reg=\/^(\\d|10)$\/;\r\nreg.test(9.2)\/\/false;\r\nreg.test(9)\/\/true;<\/pre>\n

\u6cd5\u4e8c<\/p>\n

let reg=\/^([0-9]|10)$\/\r\nreg.test(9.2)\/\/false;\r\nreg.test(9)\/\/true;<\/pre>\n
\u4e8c\u3001\u9519\u8bef\u5199\u6cd5<\/strong><\/div>\n

1.\u6b63\u5219\u8868\u8fbe\u5f0f\u91cc\u9762\u4e0d\u80fd\u968f\u4fbf\u6253 \u7a7a\u683c\u5440\uff0c\u4e5f\u4f1a\u88ab\u5f53\u505a\u4e00\u4e2a \u5339\u914d\u7b26\u53f7\u3002<\/p>\n

1)\u4ee3\u7801<\/p>\n

let reg6=\/^(\\d | 10 )$\/<\/pre>\n

2)\u7ed3\u679c\uff1a\u56e0\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u52a0\u4e86\u7a7a\u683c\uff08\\d\u540e\u9762\u52a0\u4e86\u4e00\u4e2a\u7a7a\u683c,10\u524d\u540e\u5206\u522b\u52a0\u4e86\u4e00\u4e2a\u7a7a\u683c\uff09 \uff0c\u6240\u4ee5\u53ea\u80fd\u5339\u914d\uff1a0-9\u540e\u9762\u52a0\u4e00\u4e2a\u7a7a\u683c\u7684\u5b57\u7b26\u4e32\uff0c\u5982'9 ';\u8fd8\u6709\u5b57\u7b26\u4e32 ' 10 ',\u524d\u540e\u5404\u6709\u4e00\u4e2a\u7a7a\u683c\u3002\u5177\u4f53\u60c5\u51b5\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"\"<\/p>\n

2.\u6b63\u5219\u8868\u8fbe\u5f0f\u8868\u793a \u6216 \u9009\u62e9\u65f6\uff0c\u4e0d\u4ec5\u9700\u8981 \u7528 | \u5206\u5272\u5f00\u5404\u4e2a\u9009\u9879\uff0c\u8fd8\u8981\u7528\u5c0f\u62ec\u53f7 \u628a\u6240\u6709\u9009\u9879\u62ec\u8d77\u6765\uff01\u5426\u5219\u5c31\u4f1a\u51fa\u95ee\u9898\u5440\uff0c\u5982\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u4e0d\u6dfb\u52a0\u5c0f\u62ec\u53f7\uff0c\u5339\u914d\u5230\u7684\u5b57\u7b26\u4e32\u548c \u6211\u60f3\u8981\u5339\u914d0-10\u7684\u6574\u6570\u5b8c\u5168\u4e0d\u540c\u3002<\/p>\n

1)\u4ee3\u7801<\/p>\n

let reg9=\/^\\d|10$\/<\/pre>\n

2)\u7ed3\u679c<\/p>\n

\"\"<\/p>\n

\u9644\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f 1-100\u7684\u6574\u6570<\/strong><\/div>\n

\u4e0b\u9762\u67091-100\u548c0-100\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n

1-100\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n

var reg = new RegExp(\"^([1-9]|[1-9]\\\\d|100)$\");\r\n var a=101;\r\n   if(!reg.test(a)) {\r\n           alert(\"\u8bf7\u8f93\u51651-100\u7684\u6574\u6570\uff01\")\r\n          \r\n       }<\/pre>\n

0-100\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n

var reg = new RegExp(\"^(\\\\d|[1-9]\\\\d|100)$\");\r\n  var a=101;\r\n       if(!reg.test(a)) {\r\n               alert(\"\u8bf7\u8f93\u51650-100\u7684\u6574\u6570\uff01\")\r\n              \r\n           }<\/pre>\n
\u603b\u7ed3<\/strong><\/div>\n

1.\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u4e0d\u80fd\u968f\u4fbf\u7528\u7a7a\u683c\u5440\uff0c\u867d\u7136\u6ca1\u6709\u663e\u5f0f\u7684\u4f7f\u7528 \/s \u7a7a\u683c\u5339\u914d\u7b26\uff0c\u4f46\u8fd8\u662f\u4f1a \u88ab\u5f53\u505a \u4e00\u4e2a\u5339\u914d\u7b26\u53f7\uff0c\u5fc5\u987b\u5339\u914d\u5bf9\u5e94\u4e2a\u6570\u7684\u7a7a\u683c\u624d\u53ef\u4ee5\u5339\u914d\u6210\u529f<\/p>\n

2.\u6709\u591a\u4e2a\u9009\u9879\u53ef\u4ee5\u9009\u62e9\u65f6\uff0c\u9009\u9879\u4e4b\u95f4\u7528 | \u5206\u5f00\uff0c\u6240\u6709\u9009\u9879\u8981\u7528 ()\u62ec\u8d77\u6765\u8fd9\u4e9b\u9009\u9879\uff0c\u5426\u5219\u4e5f\u662f\u6709\u95ee\u9898\u7684\u3002 \/^\\d|10$\/ \u65e0\u6cd5\u5b9e\u73b0\u5339\u914d 0-10\u7684\u6b63\u6574\u6570\uff1b\/^(\\d|10)$\/\u53ef\u4ee5\u6b63\u786e\u5339\u914d0-10\u7684\u6b63\u6574\u6570<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6ce8\uff1a\u5982\u5acc\u7e41\u7410\uff1b\u5b9e\u73b0\u65b9\u6cd5\u53ef\u76f4\u63a5\u770b\u4e00\u3001\u5b9e\u73b0\u65b9\u6cd5\uff1b\u4f7f\u7528\u7ec6\u8282\u53ef\u76f4\u63a5\u770b \u4e09\u3001\u603b\u7ed3 \u6cd5\u4e00\uff1a let reg=\/^(\\d|1 […]<\/p>\n","protected":false},"author":668,"featured_media":157550,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-258264","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/258264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=258264"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/258264\/revisions"}],"predecessor-version":[{"id":258271,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/258264\/revisions\/258271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/157550"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=258264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=258264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=258264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}