{"id":114677,"date":"2024-03-22T23:43:10","date_gmt":"2024-03-22T14:43:10","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/"},"modified":"2024-03-27T18:48:37","modified_gmt":"2024-03-27T09:48:37","slug":"python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/","title":{"rendered":"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b"},"content":{"rendered":"<p>re.search\u51fd\u6570\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u641c\u7d22\u5339\u914d\u7684\u6a21\u5f0f\u3002\u5b83\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff1a\u6a21\u5f0f\u548c\u5b57\u7b26\u4e32\u3002\u5982\u679c\u6a21\u5f0f\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u4e2d\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5426\u5219\u8fd4\u56deNone\u3002<\/p>\n<p>\u4f8b\u306e\u4f7f\u3044\u65b9\uff1a<\/p>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">import<\/span> re\r\n\r\npattern = <span class=\"hljs-string\">r\"abc\"<\/span>  <span class=\"hljs-comment\"># \u6a21\u5f0f\u5b57\u7b26\u4e32<\/span>\r\nstring = <span class=\"hljs-string\">\"xyzabc123\"<\/span>  <span class=\"hljs-comment\"># \u8981\u641c\u7d22\u7684\u5b57\u7b26\u4e32<\/span>\r\n\r\n<span class=\"hljs-keyword\">match<\/span> = re.search(pattern, string)\r\n<span class=\"hljs-keyword\">if<\/span> <span class=\"hljs-keyword\">match<\/span>:\r\n    <span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"\u627e\u5230\u5339\u914d\u9879\uff1a\"<\/span>, <span class=\"hljs-keyword\">match<\/span>.group())\r\n<span class=\"hljs-keyword\">else<\/span>:\r\n    <span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"\u672a\u627e\u5230\u5339\u914d\u9879\"<\/span>)\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\uff1a<\/p>\n<pre class=\"post-pre\"><code>\u627e\u5230\u5339\u914d\u9879\uff1a abc\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u4f8b\u3067\u306f\u3001re.search(pattern, string)\u306f\u6587\u5b57\u5217string\u4e2d\u306b\u304a\u3051\u308bpattern\u306e\u5b58\u5728\u3092\u691c\u7d22\u3057\u307e\u3059\u3002\u6587\u5b57\u5217\u4e2d\u306b&#8221;abc&#8221;\u304c\u5b58\u5728\u3059\u308b\u305f\u3081\u3001re.search\u306f\u4e00\u81f4\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3057\u307e\u3059\u3002\u4e00\u81f4\u3057\u305f\u6587\u5b57\u5217\u306f.group()\u30e1\u30bd\u30c3\u30c9\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u3082\u3057\u6587\u5b57\u5217\u4e2d\u306bpattern\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\u3001re.search\u306fNone\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>re.search\u51fd\u6570\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u641c\u7d22\u5339\u914d\u7684\u6a21\u5f0f\u3002\u5b83\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff1a\u6a21\u5f0f\u548c\u5b57\u7b26\u4e32\u3002\u5982\u679c\u6a21\u5f0f\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u4e2d\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5426\u5219\u8fd4\u56deNone\u3002 \u4f8b\u306e\u4f7f\u3044\u65b9\uff1a import re pattern = r&#8221;abc [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-114677","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/python-\u306e-re-search-\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\" \/>\n<meta property=\"og:description\" content=\"re.search\u51fd\u6570\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u641c\u7d22\u5339\u914d\u7684\u6a21\u5f0f\u3002\u5b83\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff1a\u6a21\u5f0f\u548c\u5b57\u7b26\u4e32\u3002\u5982\u679c\u6a21\u5f0f\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u4e2d\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5426\u5219\u8fd4\u56deNone\u3002 \u4f8b\u306e\u4f7f\u3044\u65b9\uff1a import re pattern = r&quot;abc [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/python-\u306e-re-search-\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-22T14:43:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-27T09:48:37+00:00\" \/>\n<meta name=\"author\" content=\"\u685c, \u6625\u6a39\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u685c, \u6625\u6a39\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/\",\"name\":\"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2024-03-22T14:43:10+00:00\",\"dateModified\":\"2024-03-27T09:48:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\",\"name\":\"\u685c, \u6625\u6a39\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"caption\":\"\u685c, \u6625\u6a39\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/python-\u306e-re-search-\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\/","og_locale":"ja_JP","og_type":"article","og_title":"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b","og_description":"re.search\u51fd\u6570\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u641c\u7d22\u5339\u914d\u7684\u6a21\u5f0f\u3002\u5b83\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff1a\u6a21\u5f0f\u548c\u5b57\u7b26\u4e32\u3002\u5982\u679c\u6a21\u5f0f\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u4e2d\u627e\u5230\u5339\u914d\u9879\uff0c\u5219\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u5bf9\u8c61\uff1b\u5426\u5219\u8fd4\u56deNone\u3002 \u4f8b\u306e\u4f7f\u3044\u65b9\uff1a import re pattern = r\"abc [&hellip;]","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/python-\u306e-re-search-\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-03-22T14:43:10+00:00","article_modified_time":"2024-03-27T09:48:37+00:00","author":"\u685c, \u6625\u6a39","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u685c, \u6625\u6a39"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/","name":"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2024-03-22T14:43:10+00:00","dateModified":"2024-03-27T09:48:37+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Python \u306e re.search \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306f\u4f55\u3067\u3059\u304b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341","name":"\u685c, \u6625\u6a39","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","caption":"\u685c, \u6625\u6a39"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%ae-re-search-%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%af%e4%bd%95%e3%81%a7%e3%81%99%e3%81%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=114677"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114677\/revisions"}],"predecessor-version":[{"id":193501,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114677\/revisions\/193501"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=114677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=114677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=114677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}