{"id":1170575,"date":"2025-01-15T16:24:12","date_gmt":"2025-01-15T08:24:12","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1170575.html"},"modified":"2025-01-15T16:24:14","modified_gmt":"2025-01-15T08:24:14","slug":"%e5%a6%82%e4%bd%95%e7%a1%ae%e5%ae%9apython%e6%98%af%e5%90%a6%e6%9c%89%e5%8c%b9%e9%85%8d","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1170575.html","title":{"rendered":"\u5982\u4f55\u786e\u5b9apython\u662f\u5426\u6709\u5339\u914d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26073146\/49d183ab-5144-42b7-ba5d-501e975ee909.webp\" alt=\"\u5982\u4f55\u786e\u5b9apython\u662f\u5426\u6709\u5339\u914d\" \/><\/p>\n<p><p> <strong>\u901a\u8fc7\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u3001\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u5185\u7f6e\u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\u7b49\u65b9\u5f0f\uff0c\u53ef\u4ee5\u786e\u5b9aPython\u662f\u5426\u6709\u5339\u914d\u3002<\/strong>\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u5904\u7406\u590d\u6742\u7684\u5339\u914d\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><p>\u6b63\u5219\u8868\u8fbe\u5f0f\uff08Regular Expressions\uff0c\u7b80\u79f0regex\uff09\u662f\u4e00\u79cd\u7528\u4e8e\u5339\u914d\u5b57\u7b26\u4e32\u6a21\u5f0f\u7684\u5de5\u5177\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7<code>re<\/code>\u6a21\u5757\u6765\u5b9e\u73b0\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u529f\u80fd\u3002\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u8f7b\u677e\u67e5\u627e\u3001\u66ff\u6362\u3001\u9a8c\u8bc1\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u6a21\u5f0f\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u786e\u5b9aPython\u4e2d\u662f\u5426\u6709\u5339\u914d\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u786e\u5b9a\u5339\u914d<\/h3>\n<\/p>\n<p><h4>1\u3001\u5f15\u5165<code>re<\/code>\u6a21\u5757\u5e76\u5b9a\u4e49\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f<\/h4>\n<\/p>\n<p><p>\u5728\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5f15\u5165<code>re<\/code>\u6a21\u5757\uff0c\u7136\u540e\u5b9a\u4e49\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u53ef\u4ee5\u662f\u4efb\u4f55\u7b26\u5408\u7279\u5b9a\u89c4\u5219\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>pattern = r&#39;\\d+&#39;  # \u5339\u914d\u4e00\u4e2a\u6216\u591a\u4e2a\u6570\u5b57<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528<code>re.search()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>re.search()<\/code>\u65b9\u6cd5\u7528\u4e8e\u641c\u7d22\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u5b58\u5728\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u5339\u914d\u7684\u90e8\u5206\u3002\u5982\u679c\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5982\u679c\u6ca1\u6709\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de<code>None<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>match = re.search(pattern, text)<\/p>\n<p>if match:<\/p>\n<p>    print(&quot;Match found:&quot;, match.group())<\/p>\n<p>else:<\/p>\n<p>    print(&quot;No match found.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u4f7f\u7528<code>re.match()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>re.match()<\/code>\u65b9\u6cd5\u7528\u4e8e\u4ece\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u5f00\u59cb\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u5982\u679c\u5728\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5982\u679c\u6ca1\u6709\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de<code>None<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;100 dollars is the price.&quot;<\/p>\n<p>match = re.match(pattern, text)<\/p>\n<p>if match:<\/p>\n<p>    print(&quot;Match found at the beginning:&quot;, match.group())<\/p>\n<p>else:<\/p>\n<p>    print(&quot;No match found at the beginning.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u4f7f\u7528<code>re.findall()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>re.findall()<\/code>\u65b9\u6cd5\u7528\u4e8e\u67e5\u627e\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u5339\u914d\u7684\u90e8\u5206\uff0c\u5e76\u4ee5\u5217\u8868\u5f62\u5f0f\u8fd4\u56de\u6240\u6709\u5339\u914d\u9879\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars and the discount is 20 dollars.&quot;<\/p>\n<p>matches = re.findall(pattern, text)<\/p>\n<p>if matches:<\/p>\n<p>    print(&quot;All matches found:&quot;, matches)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;No matches found.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u5185\u7f6e\u5b57\u7b26\u4e32\u65b9\u6cd5\u786e\u5b9a\u5339\u914d<\/h3>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>str.find()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>str.find()<\/code>\u65b9\u6cd5\u7528\u4e8e\u67e5\u627e\u5b50\u5b57\u7b26\u4e32\u5728\u5b57\u7b26\u4e32\u4e2d\u7684\u4f4d\u7f6e\u3002\u5982\u679c\u627e\u5230\u5b50\u5b57\u7b26\u4e32\uff0c\u5219\u8fd4\u56de\u5176\u5728\u5b57\u7b26\u4e32\u4e2d\u7684\u8d77\u59cb\u4f4d\u7f6e\u7d22\u5f15\uff1b\u5982\u679c\u6ca1\u6709\u627e\u5230\u5b50\u5b57\u7b26\u4e32\uff0c\u5219\u8fd4\u56de<code>-1<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>substring = &quot;100&quot;<\/p>\n<p>position = text.find(substring)<\/p>\n<p>if position != -1:<\/p>\n<p>    print(f&quot;Substring &#39;{substring}&#39; found at position {position}.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;Substring &#39;{substring}&#39; not found.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528<code>str.index()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>str.index()<\/code>\u65b9\u6cd5\u4e0e<code>str.find()<\/code>\u65b9\u6cd5\u7c7b\u4f3c\uff0c\u4f46\u5982\u679c\u6ca1\u6709\u627e\u5230\u5b50\u5b57\u7b26\u4e32\uff0c\u5219\u4f1a\u5f15\u53d1<code>ValueError<\/code>\u5f02\u5e38\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>substring = &quot;100&quot;<\/p>\n<p>try:<\/p>\n<p>    position = text.index(substring)<\/p>\n<p>    print(f&quot;Substring &#39;{substring}&#39; found at position {position}.&quot;)<\/p>\n<p>except ValueError:<\/p>\n<p>    print(f&quot;Substring &#39;{substring}&#39; not found.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u4f7f\u7528<code>str.startswith()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>str.startswith()<\/code>\u65b9\u6cd5\u7528\u4e8e\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4ee5\u6307\u5b9a\u7684\u5b50\u5b57\u7b26\u4e32\u5f00\u5934\u3002\u5982\u679c\u662f\uff0c\u5219\u8fd4\u56de<code>True<\/code>\uff1b\u5426\u5219\u8fd4\u56de<code>False<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;100 dollars is the price.&quot;<\/p>\n<p>substring = &quot;100&quot;<\/p>\n<p>if text.startswith(substring):<\/p>\n<p>    print(f&quot;The string starts with &#39;{substring}&#39;.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;The string does not start with &#39;{substring}&#39;.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u4f7f\u7528<code>str.endswith()<\/code>\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>str.endswith()<\/code>\u65b9\u6cd5\u7528\u4e8e\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4ee5\u6307\u5b9a\u7684\u5b50\u5b57\u7b26\u4e32\u7ed3\u5c3e\u3002\u5982\u679c\u662f\uff0c\u5219\u8fd4\u56de<code>True<\/code>\uff1b\u5426\u5219\u8fd4\u56de<code>False<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>substring = &quot;dollars.&quot;<\/p>\n<p>if text.endswith(substring):<\/p>\n<p>    print(f&quot;The string ends with &#39;{substring}&#39;.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;The string does not end with &#39;{substring}&#39;.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u548c\u5faa\u73af\u786e\u5b9a\u5339\u914d<\/h3>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>in<\/code>\u8fd0\u7b97\u7b26<\/h4>\n<\/p>\n<p><p><code>in<\/code>\u8fd0\u7b97\u7b26\u7528\u4e8e\u68c0\u67e5\u5b50\u5b57\u7b26\u4e32\u662f\u5426\u5b58\u5728\u4e8e\u5b57\u7b26\u4e32\u4e2d\u3002\u5982\u679c\u5b58\u5728\uff0c\u5219\u8fd4\u56de<code>True<\/code>\uff1b\u5426\u5219\u8fd4\u56de<code>False<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>substring = &quot;100&quot;<\/p>\n<p>if substring in text:<\/p>\n<p>    print(f&quot;The substring &#39;{substring}&#39; is found in the string.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;The substring &#39;{substring}&#39; is not found in the string.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528\u5faa\u73af\u904d\u5386\u5b57\u7b26\u4e32<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u5faa\u73af\u904d\u5386\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e2a\u5b57\u7b26\uff0c\u5e76\u68c0\u67e5\u662f\u5426\u5b58\u5728\u5339\u914d\u7684\u5b50\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>substring = &quot;100&quot;<\/p>\n<p>length = len(substring)<\/p>\n<p>found = False<\/p>\n<p>for i in range(len(text) - length + 1):<\/p>\n<p>    if text[i:i + length] == substring:<\/p>\n<p>        found = True<\/p>\n<p>        break<\/p>\n<p>if found:<\/p>\n<p>    print(f&quot;The substring &#39;{substring}&#39; is found in the string.&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;The substring &#39;{substring}&#39; is not found in the string.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u786e\u5b9a\u5339\u914d<\/h3>\n<\/p>\n<p><p>\u9664\u4e86Python\u5185\u7f6e\u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\u548c\u6b63\u5219\u8868\u8fbe\u5f0f\u5916\uff0c\u8fd8\u6709\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u7528\u4e8e\u5904\u7406\u5b57\u7b26\u4e32\u5339\u914d\u3002\u4f8b\u5982\uff0c<code>regex<\/code>\u5e93\u662f\u4e00\u4e2a\u589e\u5f3a\u7248\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5e93\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5<code>regex<\/code>\u5e93<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5<code>regex<\/code>\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install regex<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528<code>regex<\/code>\u5e93\u8fdb\u884c\u5339\u914d<\/h4>\n<\/p>\n<p><p><code>regex<\/code>\u5e93\u7684\u4f7f\u7528\u65b9\u6cd5\u4e0e<code>re<\/code>\u6a21\u5757\u7c7b\u4f3c\uff0c\u4f46\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u9009\u9879\u548c\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import regex<\/p>\n<p>pattern = r&#39;\\d+&#39;  # \u5339\u914d\u4e00\u4e2a\u6216\u591a\u4e2a\u6570\u5b57<\/p>\n<p>text = &quot;The price is 100 dollars.&quot;<\/p>\n<p>match = regex.search(pattern, text)<\/p>\n<p>if match:<\/p>\n<p>    print(&quot;Match found:&quot;, match.group())<\/p>\n<p>else:<\/p>\n<p>    print(&quot;No match found.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u786e\u5b9aPython\u4e2d\u662f\u5426\u5b58\u5728\u5339\u914d\u3002<strong>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u5904\u7406\u590d\u6742\u5339\u914d\u9700\u6c42\u7684\u5f3a\u5927\u5de5\u5177\uff0c\u5185\u7f6e\u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\u9002\u7528\u4e8e\u7b80\u5355\u7684\u5339\u914d\u573a\u666f\uff0c\u6761\u4ef6\u8bed\u53e5\u548c\u5faa\u73af\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u5339\u914d\u529f\u80fd\uff0c\u800c\u7b2c\u4e09\u65b9\u5e93\u5219\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u9009\u9879\u548c\u529f\u80fd\u3002<\/strong>\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u51b3\u5b57\u7b26\u4e32\u5339\u914d\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u6848\u4f8b\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u786e\u5b9aPython\u662f\u5426\u6709\u5339\u914d\uff0c\u4e0b\u9762\u901a\u8fc7\u51e0\u4e2a\u5177\u4f53\u7684\u6848\u4f8b\u6765\u5206\u6790\u548c\u6f14\u793a\u4e0d\u540c\u65b9\u6cd5\u7684\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><h4>\u6848\u4f8b1\uff1a\u9a8c\u8bc1\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u683c\u5f0f<\/h4>\n<\/p>\n<p><p>\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u7684\u683c\u5f0f\u901a\u5e38\u5305\u542b\u7528\u6237\u540d\u3001@\u7b26\u53f7\u548c\u57df\u540d\u3002\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u9a8c\u8bc1\u5b57\u7b26\u4e32\u662f\u5426\u7b26\u5408\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u7684\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def is_valid_em<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>l(email):<\/p>\n<p>    pattern = r&#39;^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$&#39;<\/p>\n<p>    return re.match(pattern, email) is not None<\/p>\n<p>emails = [&quot;test@example.com&quot;, &quot;invalid-email&quot;, &quot;user@domain&quot;, &quot;user@domain.com&quot;]<\/p>\n<p>for email in emails:<\/p>\n<p>    if is_valid_email(email):<\/p>\n<p>        print(f&quot;&#39;{email}&#39; is a valid email address.&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;&#39;{email}&#39; is not a valid email address.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u6848\u4f8b2\uff1a\u63d0\u53d6\u6587\u672c\u4e2d\u7684\u7535\u8bdd\u53f7\u7801<\/h4>\n<\/p>\n<p><p>\u7535\u8bdd\u53f7\u7801\u901a\u5e38\u7531\u6570\u5b57\u3001\u7a7a\u683c\u3001\u8fde\u5b57\u7b26\u6216\u62ec\u53f7\u7ec4\u6210\u3002\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4ece\u6587\u672c\u4e2d\u63d0\u53d6\u6240\u6709\u7684\u7535\u8bdd\u53f7\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def extract_phone_numbers(text):<\/p>\n<p>    pattern = r&#39;\\(?\\d{3}\\)?[-.\\s]?\\d{3}[-.\\s]?\\d{4}&#39;<\/p>\n<p>    return re.findall(pattern, text)<\/p>\n<p>text = &quot;Contact us at (123) 456-7890 or 987-654-3210.&quot;<\/p>\n<p>phone_numbers = extract_phone_numbers(text)<\/p>\n<p>print(&quot;Extracted phone numbers:&quot;, phone_numbers)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u6848\u4f8b3\uff1a\u68c0\u67e5\u5bc6\u7801\u5f3a\u5ea6<\/h4>\n<\/p>\n<p><p>\u5f3a\u5bc6\u7801\u901a\u5e38\u5305\u542b\u5927\u5199\u5b57\u6bcd\u3001\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7279\u6b8a\u5b57\u7b26\u3002\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u7b26\u5408\u5f3a\u5bc6\u7801\u7684\u8981\u6c42\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def is_strong_password(password):<\/p>\n<p>    pattern = r&#39;^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&amp;])[A-Za-z\\d@$!%*?&amp;]{8,}$&#39;<\/p>\n<p>    return re.match(pattern, password) is not None<\/p>\n<p>passwords = [&quot;Password123!&quot;, &quot;weakpassword&quot;, &quot;Strong1!&quot;, &quot;StrongerPassword1!&quot;]<\/p>\n<p>for password in passwords:<\/p>\n<p>    if is_strong_password(password):<\/p>\n<p>        print(f&quot;&#39;{password}&#39; is a strong password.&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;&#39;{password}&#39; is not a strong password.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u8fdb\u9636\u6280\u5de7<\/h3>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528\u547d\u540d\u6355\u83b7\u7ec4<\/h4>\n<\/p>\n<p><p>\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u540d\u6355\u83b7\u7ec4\u6765\u7ed9\u5339\u914d\u7684\u5b50\u5b57\u7b26\u4e32\u547d\u540d\uff0c\u4ece\u800c\u66f4\u65b9\u4fbf\u5730\u63d0\u53d6\u548c\u5904\u7406\u5339\u914d\u9879\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def extract_named_groups(text):<\/p>\n<p>    pattern = r&#39;(?P&lt;area_code&gt;\\d{3})[-.\\s]?(?P&lt;exchange_code&gt;\\d{3})[-.\\s]?(?P&lt;number&gt;\\d{4})&#39;<\/p>\n<p>    match = re.search(pattern, text)<\/p>\n<p>    if match:<\/p>\n<p>        return match.groupdict()<\/p>\n<p>    return None<\/p>\n<p>text = &quot;Contact us at 123-456-7890.&quot;<\/p>\n<p>named_groups = extract_named_groups(text)<\/p>\n<p>print(&quot;Named groups:&quot;, named_groups)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528\u975e\u8d2a\u5a6a\u5339\u914d<\/h4>\n<\/p>\n<p><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u91c7\u7528\u8d2a\u5a6a\u5339\u914d\uff0c\u5373\u5c3d\u53ef\u80fd\u591a\u5730\u5339\u914d\u5b57\u7b26\u3002\u53ef\u4ee5\u4f7f\u7528\u975e\u8d2a\u5a6a\u5339\u914d\u6765\u5c3d\u53ef\u80fd\u5c11\u5730\u5339\u914d\u5b57\u7b26\uff0c\u4ece\u800c\u907f\u514d\u8fc7\u5ea6\u5339\u914d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def extract_non_greedy(text):<\/p>\n<p>    pattern = r&#39;&lt;.*?&gt;&#39;<\/p>\n<p>    return re.findall(pattern, text)<\/p>\n<p>text = &quot;&lt;p&gt;This is a paragraph.&lt;\/p&gt;&lt;p&gt;This is another paragraph.&lt;\/p&gt;&quot;<\/p>\n<p>non_greedy_matches = extract_non_greedy(text)<\/p>\n<p>print(&quot;Non-greedy matches:&quot;, non_greedy_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u4f7f\u7528\u65ad\u8a00<\/h4>\n<\/p>\n<p><p>\u65ad\u8a00\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u7528\u4e8e\u6307\u5b9a\u5339\u914d\u9879\u7684\u4e0a\u4e0b\u6587\u6761\u4ef6\u3002\u5e38\u89c1\u7684\u65ad\u8a00\u5305\u62ec\u6b63\u5411\u5148\u884c\u65ad\u8a00\u3001\u8d1f\u5411\u5148\u884c\u65ad\u8a00\u3001\u6b63\u5411\u540e\u884c\u65ad\u8a00\u548c\u8d1f\u5411\u540e\u884c\u65ad\u8a00\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def extract_words_followed_by_exclamation(text):<\/p>\n<p>    pattern = r&#39;\\b\\w+(?=!)&#39;<\/p>\n<p>    return re.findall(pattern, text)<\/p>\n<p>text = &quot;Hello! How are you? Wow! Amazing!&quot;<\/p>\n<p>words_followed_by_exclamation = extract_words_followed_by_exclamation(text)<\/p>\n<p>print(&quot;Words followed by exclamation:&quot;, words_followed_by_exclamation)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><h4>1\u3001\u5339\u914d\u591a\u884c\u6587\u672c<\/h4>\n<\/p>\n<p><p>\u5728\u5904\u7406\u591a\u884c\u6587\u672c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>re.MULTILINE<\/code>\u6807\u5fd7\u6765\u4f7f\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u951a\u70b9\uff08\u5982<code>^<\/code>\u548c<code>$<\/code>\uff09\u5339\u914d\u6bcf\u4e00\u884c\u7684\u5f00\u5934\u548c\u7ed3\u5c3e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def match_multiline_text(text):<\/p>\n<p>    pattern = r&#39;^\\w+&#39;<\/p>\n<p>    return re.findall(pattern, text, re.MULTILINE)<\/p>\n<p>text = &quot;&quot;&quot;First line<\/p>\n<p>Second line<\/p>\n<p>Third line&quot;&quot;&quot;<\/p>\n<p>multiline_matches = match_multiline_text(text)<\/p>\n<p>print(&quot;Multiline matches:&quot;, multiline_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5ffd\u7565\u5927\u5c0f\u5199\u5339\u914d<\/h4>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u5339\u914d\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>re.IGNORECASE<\/code>\u6807\u5fd7\u6765\u5ffd\u7565\u5b57\u7b26\u7684\u5927\u5c0f\u5199\uff0c\u4ece\u800c\u5b9e\u73b0\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def match_ignore_case(text):<\/p>\n<p>    pattern = r&#39;hello&#39;<\/p>\n<p>    return re.findall(pattern, text, re.IGNORECASE)<\/p>\n<p>text = &quot;Hello, hello, HELLO!&quot;<\/p>\n<p>ignore_case_matches = match_ignore_case(text)<\/p>\n<p>print(&quot;Ignore case matches:&quot;, ignore_case_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u5904\u7406\u7279\u6b8a\u5b57\u7b26<\/h4>\n<\/p>\n<p><p>\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\uff0c\u4e00\u4e9b\u5b57\u7b26\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff08\u5982<code>.<\/code>\u3001<code>*<\/code>\u3001<code>+<\/code>\u7b49\uff09\u3002\u5982\u679c\u9700\u8981\u5339\u914d\u8fd9\u4e9b\u5b57\u7b26\u672c\u8eab\uff0c\u53ef\u4ee5\u4f7f\u7528\u53cd\u659c\u6760\u8fdb\u884c\u8f6c\u4e49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def match_special_characters(text):<\/p>\n<p>    pattern = r&#39;\\.&#39;<\/p>\n<p>    return re.findall(pattern, text)<\/p>\n<p>text = &quot;Match the period character.&quot;<\/p>\n<p>special_char_matches = match_special_characters(text)<\/p>\n<p>print(&quot;Special character matches:&quot;, special_char_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e5d\u3001\u4f18\u5316\u6b63\u5219\u8868\u8fbe\u5f0f\u6027\u80fd<\/h3>\n<\/p>\n<p><p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u6027\u80fd\u53ef\u80fd\u4f1a\u53d7\u5230\u6a21\u5f0f\u590d\u6742\u5ea6\u548c\u8f93\u5165\u5b57\u7b26\u4e32\u957f\u5ea6\u7684\u5f71\u54cd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f18\u5316\u6b63\u5219\u8868\u8fbe\u5f0f\u6027\u80fd\u7684\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u907f\u514d\u8fc7\u5ea6\u56de\u6eaf<\/h4>\n<\/p>\n<p><p>\u5728\u8bbe\u8ba1\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u65f6\uff0c\u5e94\u907f\u514d\u4f7f\u7528\u53ef\u80fd\u5bfc\u81f4\u8fc7\u5ea6\u56de\u6eaf\u7684\u7ed3\u6784\uff0c\u5982\u5d4c\u5957\u7684\u91cf\u8bcd\u548c\u4e0d\u5fc5\u8981\u7684\u6355\u83b7\u7ec4\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def optimized_pattern(text):<\/p>\n<p>    pattern = r&#39;(?:\\d+|[a-zA-Z]+)&#39;<\/p>\n<p>    return re.findall(pattern, text)<\/p>\n<p>text = &quot;123abc456def&quot;<\/p>\n<p>optimized_matches = optimized_pattern(text)<\/p>\n<p>print(&quot;Optimized matches:&quot;, optimized_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528\u9884\u7f16\u8bd1\u6a21\u5f0f<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u591a\u6b21\u4f7f\u7528\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528<code>re.compile()<\/code>\u65b9\u6cd5\u9884\u7f16\u8bd1\u6a21\u5f0f\uff0c\u4ece\u800c\u63d0\u9ad8\u5339\u914d\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def precompiled_pattern(text, pattern):<\/p>\n<p>    compiled_pattern = re.compile(pattern)<\/p>\n<p>    return compiled_pattern.findall(text)<\/p>\n<p>text = &quot;The price is 100 dollars and the discount is 20 dollars.&quot;<\/p>\n<p>pattern = r&#39;\\d+&#39;<\/p>\n<p>precompiled_matches = precompiled_pattern(text, pattern)<\/p>\n<p>print(&quot;Precompiled matches:&quot;, precompiled_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u5206\u5272\u5927\u6587\u672c<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u975e\u5e38\u5927\u7684\u6587\u672c\uff0c\u53ef\u4ee5\u5c06\u5176\u5206\u5272\u4e3a\u8f83\u5c0f\u7684\u90e8\u5206\u8fdb\u884c\u5339\u914d\uff0c\u4ece\u800c\u51cf\u5c11\u5355\u6b21\u5339\u914d\u7684\u8d1f\u62c5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>def split_and_match(text, pattern, chunk_size=1000):<\/p>\n<p>    matches = []<\/p>\n<p>    for i in range(0, len(text), chunk_size):<\/p>\n<p>        chunk = text[i:i + chunk_size]<\/p>\n<p>        matches.extend(re.findall(pattern, chunk))<\/p>\n<p>    return matches<\/p>\n<p>text = &quot;a&quot; * 5000 + &quot;100&quot; + &quot;b&quot; * 5000 + &quot;200&quot;<\/p>\n<p>pattern = r&#39;\\d+&#39;<\/p>\n<p>split_matches = split_and_match(text, pattern)<\/p>\n<p>print(&quot;Split matches:&quot;, split_matches)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p><strong>\u786e\u5b9aPython\u662f\u5426\u6709\u5339\u914d\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u5185\u7f6e\u5b57\u7b26\u4e32\u65b9\u6cd5\u3001\u6761\u4ef6\u8bed\u53e5\u548c\u5faa\u73af\u7b49\u3002<\/strong>\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u9002\u7528\u4e8e\u5904\u7406\u590d\u6742\u7684\u5339\u914d\u9700\u6c42\uff1b\u5185\u7f6e\u5b57\u7b26\u4e32\u65b9\u6cd5\u63d0\u4f9b\u4e86\u7b80\u5355\u9ad8\u6548\u7684\u89e3\u51b3\u65b9\u6848\uff1b\u6761\u4ef6\u8bed\u53e5\u548c\u5faa\u73af\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u5339\u914d\u529f\u80fd\u3002\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u51b3\u5404\u79cd\u5b57\u7b26\u4e32\u5339\u914d\u95ee\u9898\u3002\u540c\u65f6\uff0c\u4f18\u5316\u6b63\u5219\u8868\u8fbe\u5f0f\u6027\u80fd\u548c\u5904\u7406\u5e38\u89c1\u95ee\u9898\u4e5f\u662f\u63d0\u9ad8\u5339\u914d\u6548\u7387\u548c\u51c6\u786e\u6027\u7684\u5173\u952e\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u5e76\u7075\u6d3b\u8fd0\u7528\u8fdb\u9636\u6280\u5de7\u548c\u4f18\u5316\u7b56\u7565\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u89e3\u51b3\u5b57\u7b26\u4e32\u5339\u914d\u95ee\u9898\u3002\u5e0c\u671b\u672c\u6587\u63d0\u4f9b\u7684\u5185\u5bb9\u80fd\u591f\u5e2e\u52a9\u60a8\u6df1\u5165\u7406\u89e3\u548c\u5e94\u7528Python\u4e2d\u7684\u5339\u914d\u6280\u672f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5Python\u4e2d\u662f\u5426\u5b58\u5728\u7279\u5b9a\u7684\u5339\u914d\u9879\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>re<\/code>\u6a21\u5757\u6765\u68c0\u67e5\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u6709\u5339\u914d\u9879\u3002\u901a\u8fc7<code>re.search()<\/code>\u51fd\u6570\uff0c\u60a8\u53ef\u4ee5\u641c\u7d22\u6574\u4e2a\u5b57\u7b26\u4e32\u4ee5\u627e\u5230\u5339\u914d\u7684\u6a21\u5f0f\u3002\u5982\u679c\u627e\u5230\u4e86\u5339\u914d\u9879\uff0c\u5b83\u5c06\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5982\u679c\u6ca1\u6709\u627e\u5230\uff0c\u5219\u8fd4\u56de<code>None<\/code>\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-python\">import re\n\npattern = r&quot;your_pattern&quot;\nstring = &quot;your_string&quot;\nmatch = re.search(pattern, string)\n\nif match:\n    print(&quot;\u5339\u914d\u9879\u5b58\u5728&quot;)\nelse:\n    print(&quot;\u6ca1\u6709\u5339\u914d\u9879&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8f7b\u677e\u786e\u5b9a\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u6709\u60a8\u60f3\u8981\u7684\u5339\u914d\u3002<\/p>\n<p><strong>\u5728\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u65f6\uff0c\u5982\u4f55\u4f18\u5316\u5339\u914d\u6548\u7387\uff1f<\/strong><br \/>\u4e3a\u4e86\u63d0\u9ad8\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u6548\u7387\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u539f\u751f\u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\uff0c\u5982<code>in<\/code>\u5173\u952e\u5b57\u8fdb\u884c\u7b80\u5355\u7684\u67e5\u627e\u3002\u5bf9\u4e8e\u590d\u6742\u7684\u5339\u914d\uff0c\u5c3d\u91cf\u907f\u514d\u4f7f\u7528\u8fc7\u4e8e\u590d\u6742\u7684\u6a21\u5f0f\uff0c\u5e76\u4f7f\u7528\u975e\u6355\u83b7\u7ec4\u6765\u4f18\u5316\u6027\u80fd\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>re.compile()<\/code>\u5c06\u6b63\u5219\u8868\u8fbe\u5f0f\u7f16\u8bd1\u4e3a\u53ef\u91cd\u7528\u7684\u6a21\u5f0f\uff0c\u53ef\u4ee5\u63d0\u9ad8\u591a\u6b21\u5339\u914d\u7684\u6548\u7387\u3002<\/p>\n<p><strong>\u5982\u679c\u6ca1\u6709\u627e\u5230\u5339\u914d\uff0c\u5982\u4f55\u5904\u7406\uff1f<\/strong><br \/>\u5982\u679c\u5728Python\u4e2d\u6ca1\u6709\u627e\u5230\u5339\u914d\u9879\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u591a\u79cd\u5904\u7406\u65b9\u5f0f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u901a\u8fc7\u8fd4\u56de\u4e00\u4e2a\u9ed8\u8ba4\u503c\u3001\u629b\u51fa\u5f02\u5e38\u6216\u8bb0\u5f55\u65e5\u5fd7\u6765\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\uff0c\u60a8\u53ef\u4ee5\u8bbe\u8ba1\u5408\u9002\u7684\u9519\u8bef\u5904\u7406\u903b\u8f91\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u548c\u7528\u6237\u4f53\u9a8c\u3002\u4f7f\u7528<code>try-except<\/code>\u5757\u4e5f\u53ef\u4ee5\u6355\u83b7\u6f5c\u5728\u7684\u9519\u8bef\uff0c\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u901a\u8fc7\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u3001\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u5185\u7f6e\u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\u7b49\u65b9\u5f0f\uff0c\u53ef\u4ee5\u786e\u5b9aPython\u662f\u5426\u6709\u5339\u914d\u3002\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f [&hellip;]","protected":false},"author":3,"featured_media":1170583,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170575"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1170575"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170575\/revisions"}],"predecessor-version":[{"id":1170585,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170575\/revisions\/1170585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1170583"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1170575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1170575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1170575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}