﻿{"id":453,"date":"2017-06-22T16:29:03","date_gmt":"2017-06-22T08:29:03","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=453"},"modified":"2017-06-22T16:29:03","modified_gmt":"2017-06-22T08:29:03","slug":"%e4%b8%80%e4%b8%aa%e5%8c%b9%e9%85%8d%e6%95%b0%e5%ad%97%e5%92%8c%e5%ad%97%e6%af%8d%e5%af%86%e7%a0%81%e7%9a%84%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=453","title":{"rendered":"\u4e00\u4e2a\u5339\u914d\u6570\u5b57\u548c\u5b57\u6bcd\u5bc6\u7801\u7684\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"<p>\u4e00\u4e2a\u7528\u6237\u6ce8\u518c\u529f\u80fd\u7684\u5bc6\u7801\u6709\u5982\u4e0b\u8981\u6c42\uff1a\u7531\u6570\u5b57\u548c\u5b57\u6bcd\u7ec4\u6210\uff0c\u5e76\u4e14\u8981\u540c\u65f6\u542b\u6709\u6570\u5b57\u548c\u5b57\u6bcd\uff0c\u4e14\u957f\u5ea6\u8981\u57288-16\u4f4d\u4e4b\u95f4\u3002<\/p>\n<p>\u5982\u4f55\u5206\u6790\u9700\u6c42\uff1f\u62c6\u5206\uff01\u8fd9\u5c31\u662f\u8f6f\u4ef6\u8bbe\u8ba1\u7684\u4e00\u822c\u601d\u8def\u4e86\u3002\u4e8e\u662f\u4e4e\uff0c\u62c6\u5206\u9700\u6c42\u5982\u4e0b\uff1a<br \/>\n1\uff0c\u4e0d\u80fd\u5168\u90e8\u662f\u6570\u5b57<br \/>\n2\uff0c\u4e0d\u80fd\u5168\u90e8\u662f\u5b57\u6bcd<br \/>\n3\uff0c\u5fc5\u987b\u662f\u6570\u5b57\u6216\u5b57\u6bcd<br \/>\n\u53ea\u8981\u80fd\u540c\u65f6\u6ee1\u8db3\u4e0a\u97623\u4e2a\u8981\u6c42\u5c31\u53ef\u4ee5\u4e86\uff0c\u5199\u51fa\u6765\u5982\u4e0b\uff1a<\/p>\n<div class=\"ssh_panel\">\n<pre class=\"lang:default decode:true  \">^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$<\/pre>\n<p>\u5206\u5f00\u6765\u6ce8\u91ca\u4e00\u4e0b\uff1a<\/p>\n<\/div>\n<p>^ \u5339\u914d\u4e00\u884c\u7684\u5f00\u5934\u4f4d\u7f6e<br \/>\n(?![0-9]+$) \u9884\u6d4b\u8be5\u4f4d\u7f6e\u540e\u9762\u4e0d\u5168\u662f\u6570\u5b57<br \/>\n(?![a-zA-Z]+$) \u9884\u6d4b\u8be5\u4f4d\u7f6e\u540e\u9762\u4e0d\u5168\u662f\u5b57\u6bcd<br \/>\n[0-9A-Za-z] {8,16} \u75318-16\u4f4d\u6570\u5b57\u6216\u8fd9\u5b57\u6bcd\u7ec4\u6210<br \/>\n$ \u5339\u914d\u884c\u7ed3\u5c3e\u4f4d\u7f6e<\/p>\n<p>\u6ce8\uff1a(?!xxxx) \u662f\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u8d1f\u5411\u96f6\u5bbd\u65ad\u8a00\u4e00\u79cd\u5f62\u5f0f\uff0c\u6807\u8bc6\u9884\u8be5\u4f4d\u7f6e\u540e\u4e0d\u662fxxxx\u5b57\u7b26\u3002<\/p>\n<p><a class=\"replace_word\" title=\"\u8f6f\u4ef6\u6d4b\u8bd5\u77e5\u8bc6\u5e93\" href=\"http:\/\/lib.csdn.net\/base\/softwaretest\" target=\"_blank\">\u6d4b\u8bd5<\/a>\u7528\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:java decode:true \">public class Test {\r\n    public static void main(String[] args) throws Exception {\r\n        String regex = \"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$\";        \r\n \r\n        String value = \"aaa\";  \/\/ \u957f\u5ea6\u4e0d\u591f\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"1111aaaa1111aaaaa\";  \/\/ \u592a\u957f\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"111111111\"; \/\/ \u7eaf\u6570\u5b57\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"aaaaaaaaa\"; \/\/ \u7eaf\u5b57\u6bcd\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"####@@@@#\"; \/\/ \u7279\u6b8a\u5b57\u7b26\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"1111aaaa\";  \/\/ \u6570\u5b57\u5b57\u6bcd\u7ec4\u5408\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"aaaa1111\"; \/\/ \u6570\u5b57\u5b57\u6bcd\u7ec4\u5408\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"aa1111aa\";    \/\/ \u6570\u5b57\u5b57\u6bcd\u7ec4\u5408\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"11aaaa11\";    \/\/ \u6570\u5b57\u5b57\u6bcd\u7ec4\u5408\r\n        System.out.println(value.matches(regex));\r\n \r\n        value = \"aa11aa11\"; \/\/ \u6570\u5b57\u5b57\u6bcd\u7ec4\u5408\r\n        System.out.println(value.matches(regex));\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u4e2a\u7528\u6237\u6ce8\u518c\u529f\u80fd\u7684\u5bc6\u7801\u6709\u5982\u4e0b\u8981\u6c42\uff1a\u7531\u6570\u5b57\u548c\u5b57\u6bcd\u7ec4\u6210\uff0c\u5e76\u4e14\u8981\u540c\u65f6\u542b\u6709\u6570\u5b57\u548c\u5b57\u6bcd\uff0c\u4e14\u957f\u5ea6\u8981\u57288-16\u4f4d\u4e4b\u95f4\u3002 \u5982\u4f55 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[159],"tags":[161,160],"class_list":["post-453","post","type-post","status-publish","format-standard","hentry","category-159","tag-161","tag-160"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=453"}],"version-history":[{"count":1,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":454,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions\/454"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}