{"id":735,"date":"2020-03-25T21:26:48","date_gmt":"2020-03-25T12:26:48","guid":{"rendered":"https:\/\/todosoft.net\/blog\/?p=735"},"modified":"2021-03-14T05:39:04","modified_gmt":"2021-03-13T20:39:04","slug":"post-735","status":"publish","type":"post","link":"https:\/\/todosoft.net\/blog\/?p=735","title":{"rendered":"C#\u3067\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3046 (IsMatch\/Match)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u6b63\u898f\u8868\u73fe\u306e\u30c6\u30b9\u30c8\u306b\u4fbf\u5229\u306a\u30b5\u30a4\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li> <a rel=\"noreferrer noopener\" aria-label=\"Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\" href=\"https:\/\/regex101.com\/\" target=\"_blank\">Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript<\/a> <\/li><li> <a href=\"https:\/\/rubular.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Rubular: a Ruby regular expression editor (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\">Rubular: a Ruby regular expression editor<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">IsMatch<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">string strTarget = @\"\u672c\u65e5\u306f\u9589\u5e97\u306a\u308a\";\n\nif(Regex.IsMatch(strTarget, @\"(.+?)\u306f(.+?)\u306a\u308a$\"))\n{\n    Console.WriteLine(\"IsMatch : Match!!\");\n}<\/code><\/pre>\n\n\n\n<p>IsMatch : Match!!<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Match<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">string strTarget = @\"\u672c\u65e5\u306f\u9589\u5e97\u306a\u308a\";\n\nMatch objMatch = Regex.Match(strTarget, @\"(.+?)\u306f(.+?)\u306a\u308a$\");\nif (objMatch.Success)\n{\n    Console.WriteLine(\"Groups[1] : \" + objMatch.Groups[1].Value);\n    Console.WriteLine(\"Groups[2] : \" + objMatch.Groups[2].Value);\n}<\/code><\/pre>\n\n\n\n<p>Groups[1] : \u672c\u65e5<br>Groups[2] : \u9589\u5e97<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Match (\u30b0\u30eb\u30fc\u30d7\u540d\u6307\u5b9a)<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">string strTarget = @\"\u672c\u65e5\u306f\u9589\u5e97\u306a\u308a\";\n\nMatch objMatchGroup = Regex.Match(strTarget, @\"(?&lt;day>.+?)\u306f(?&lt;action>.+?)\u306a\u308a$\");\nif (objMatchGroup.Success)\n{\n    Console.WriteLine(\"Groups[day] : \" + objMatchGroup.Groups[\"day\"].Value);\n    Console.WriteLine(\"Groups[action] : \" + objMatchGroup.Groups[\"action\"].Value);\n}<\/code><\/pre>\n\n\n\n<p>Groups[day] : \u672c\u65e5<br>Groups[action] : \u9589\u5e97<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8907\u6570\u4ef6\u30de\u30c3\u30c1\u3055\u305b\u308b\u5834\u5408<\/h3>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">string strTarget = @\"\u672c\u65e5\u306f\u9589\u5e97\u306a\u308a\u3002\u660e\u65e5\u306f\u958b\u5e97\u306a\u308a\u3002\";\n\nMatch objMatchGroup = Regex.Match(strTarget, @\"(?&lt;day>.+?)\u306f(?&lt;action>.+?)\u306a\u308a\u3002\");\n\nwhile (objMatchGroup.Success) {\n    Console.WriteLine(\"Groups[day] : \" + objMatchGroup.Groups[\"day\"].Value);\n    Console.WriteLine(\"Groups[action] : \" + objMatchGroup.Groups[\"action\"].Value);\n\n    objMatchGroup = objMatchGroup.NextMatch();\n}<\/code><\/pre>\n\n\n\n<p>Groups[day] : \u672c\u65e5<br>Groups[action] : \u9589\u5e97<br>Groups[day] : \u660e\u65e5<br>Groups[action] : \u958b\u5e97<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u898f\u8868\u73fe\u306e\u30c6\u30b9\u30c8\u306b\u4fbf\u5229\u306a\u30b5\u30a4\u30c8 Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript Rubular: a Ruby reg [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,15],"tags":[85],"class_list":["post-735","post","type-post","status-publish","format-standard","hentry","category-c","category-15","tag-85"],"_links":{"self":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=735"}],"version-history":[{"count":5,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/735\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}