{"id":313,"date":"2023-02-24T22:24:06","date_gmt":"2023-02-24T14:24:06","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=313"},"modified":"2023-04-30T15:01:33","modified_gmt":"2023-04-30T07:01:33","slug":"regular-expressions-in-php-that-not-start-with-a-character","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/regular-expressions-in-php-that-not-start-with-a-character\/","title":{"rendered":"PHP\u4ee5\u4e0d\u662f\u67d0\u5b57\u7b26\u5f00\u5934\u7684\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"<p>\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a^[^c]\uff0c\u5176\u4e2dc\u4e3a\u5b57\u7b26<\/p>\n<p>\u4f8b\u4e00\uff1a\u9996\u5b57\u7b26\u4e0d\u80fd\u4e3aa<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-php\">$test1 = &quot;a123456&quot;;  \/\/\u5339\u914d\u5931\u8d25\nif (preg_match(&quot;\/^[^a]\/&quot;, $test1)) {\n    echo &#039;\u5339\u914d\u6210\u529f&lt;hr \/&gt;&#039;;\n} else {\n    echo &#039;\u5339\u914d\u5931\u8d25&lt;hr \/&gt;&#039;;\n}\n\n$test2 = &quot;0123456&quot;;  \/\/\u5339\u914d\u6210\u529f\nif (preg_match(&quot;\/^[^a]\/&quot;, $test2)) {\n    echo &#039;\u5339\u914d\u6210\u529f&lt;hr \/&gt;&#039;;\n} else {\n    echo &#039;\u5339\u914d\u5931\u8d25&lt;hr \/&gt;&#039;;\n}<\/code><\/pre>\n<p>\u4f8b\u4e8c\uff1a\u9996\u5b57\u7b26\u4e0d\u80fd\u4e3a*<\/p>\n<pre><code class=\"language-php\">$test1 = &quot;*123456&quot;;  \/\/\u5339\u914d\u5931\u8d25\nif (preg_match(&quot;\/^[^\\*]\/&quot;, $test1)) {\n    echo &#039;\u5339\u914d\u6210\u529f&lt;hr \/&gt;&#039;;\n} else {\n    echo &#039;\u5339\u914d\u5931\u8d25&lt;hr \/&gt;&#039;;\n}\n\n$test2 = &quot;0123456&quot;;  \/\/\u5339\u914d\u6210\u529f\nif (preg_match(&quot;\/^[^\\*]\/&quot;, $test2)) {\n    echo &#039;\u5339\u914d\u6210\u529f&lt;hr \/&gt;&#039;;\n} else {\n    echo &#039;\u5339\u914d\u5931\u8d25&lt;hr \/&gt;&#039;;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a^[^c]\uff0c\u5176\u4e2dc\u4e3a\u5b57\u7b26 \u4f8b\u4e00\uff1a\u9996\u5b57\u7b26\u4e0d\u80fd\u4e3aa $test1 = &quot;a123456&#038;qu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-php-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=313"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/313\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}