{"id":1788,"date":"2023-02-06T20:50:14","date_gmt":"2023-02-06T11:50:14","guid":{"rendered":"https:\/\/ptune.jp\/tech\/?p=1788"},"modified":"2023-02-06T20:51:29","modified_gmt":"2023-02-06T11:51:29","slug":"select-value-get","status":"publish","type":"post","link":"https:\/\/ptune.jp\/tech\/select-value-get\/","title":{"rendered":"\u30b7\u30ca\u30ea\u30aa\u4f5c\u6210#ex4_\u8907\u6570\u306eselect\u30bf\u30b0\u304b\u3089\u7279\u5b9a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<p>SELECT\u30bf\u30b0\u304c\u8907\u6570\u3042\u308a\u3001OPTION\u306e\u30d0\u30ea\u30e5\u30fc\u3092\u30e9\u30f3\u30c0\u30e0\u3067\u53d6\u308a\u305f\u3044\u5834\u5408\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<h2>\u60f3\u5b9a\u30b7\u30c1\u30e5\u30a8\u30fc\u30b7\u30e7\u30f3\u3068\u8ab2\u984c<\/h2>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001\u8907\u6570\u306eSELECT\u30bf\u30b0\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u5834\u5408\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-html\">\u60c5\u5831\uff21\u306b\u3064\u3044\u3066\u9078\u629e\n&lt;select name=&quot;infoA&quot;&gt;\n&lt;option value=&quot;1&quot;&gt;\u60c5\u5831A1&lt;\/option&gt;\n&lt;option value=&quot;2&quot; selected=&quot;selected&quot;&gt;\u60c5\u5831A2&lt;\/option&gt;\n&lt;option value=&quot;3&quot;&gt;\u60c5\u5831A3&lt;\/option&gt;\n&lt;\/select&gt;\n\n\u60c5\u5831\uff22\u306b\u3064\u3044\u3066\u9078\u629e\n&lt;select name=&quot;infoB&quot;&gt;\n&lt;option value=&quot;1&quot;&gt;\u60c5\u5831B1&lt;\/option&gt;\n&lt;option value=&quot;2&quot; selected=&quot;selected&quot;&gt;\u60c5\u5831B2&lt;\/option&gt;\n&lt;option value=&quot;3&quot;&gt;\u60c5\u5831B3&lt;\/option&gt;\n&lt;\/select&gt;\n<\/code><\/pre>\n<p>\u901a\u5e38\u3067\u3042\u308c\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u6b63\u898f\u8868\u73fe\u62bd\u51fa\u3067\u4e00\u81f4\u756a\u53f7\u3092\u300c0\u300d\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u60c5\u5831\u3092\u30e9\u30f3\u30c0\u30e0\u3067\u53d6\u5f97\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-html\">&lt;option value=&quot;(.*)&quot;&gt;(.*)&lt;\/option&gt;<\/code><\/pre>\n<p>\u3057\u304b\u3057\u306a\u304c\u3089\u3001SELECT\u30bf\u30b0\u304c\u8907\u6570\u3042\u308b\u305f\u3081\u3001\u60f3\u5b9a\u5916\u306eSELECT\u30bf\u30b0\u306e\u60c5\u5831\u304c\u3068\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<h2>BeanShellPostProcessor\u3092\u4f7f\u3063\u3066\u53d6\u5f97<\/h2>\n<p>\u6b63\u898f\u8868\u73fe\u62bd\u51fa\u306f\u3042\u304d\u3089\u3081\u3066\u3001BeanShellPostProcessor\u3092\u4f7f\u3063\u3066\u53d6\u5f97\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u30bd\u30fc\u30b9\u7684\u306b\u306fselected\u90e8\u5206\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30e9\u30f3\u30c0\u30e0\u306b\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u7b49\u3001\u7528\u9014\u306b\u5fdc\u3058\u3066\u4fee\u6b63\u3057\u3066\u3082\u3089\u3048\u308c\u3070\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-java\">import java.util.regex.Pattern;\nimport java.util.regex.Matcher;\n\nString body = prev.getResponseDataAsString();\nString[] lines = body.split(&quot;\\n&quot;);\n\nPattern findTitle = Pattern.compile(&quot;&lt;select name=\\&quot;infoA\\&quot;&gt;&quot;);\nPattern findSelected = Pattern.compile(&quot;selected&quot;);\nPattern findSelectClose = Pattern.compile(&quot;&lt;\/select&gt;&quot;);\nPattern findValue = Pattern.compile(&quot;value=\\&quot;(.*?)\\&quot;&quot;);\nPattern findLabel = Pattern.compile(&quot;value=\\&quot;(.*)\\&quot;&gt;(.*?)&lt;\/&quot;); \nboolean targetRange = false;\n\nfor(String line: lines){\n    \/\/ \u5bfe\u8c61\u7bc4\u56f2\u306e\u7279\u5b9a\n    Matcher title = findTitle.matcher(line);\n    if(title.find() || targetRange){\n        \/\/ log.info(line);\n        targetRange = true;\n\n        \/\/ selected\u306e\u7279\u5b9a\n        Matcher selected = findSelected.matcher(line);\n        if(selected.find()){\n            Matcher label = findLabel.matcher(line);\n            Matcher value = findValue.matcher(line);\n            if(label.find() &amp;&amp; value.find()){\n                \/\/ \u5909\u6570\u306b\u683c\u7d0d\n                \/\/ log.info(label.group(1) +&quot;,&quot;+value.group(1));\n                vars.put(&quot;value&quot;,value.group(1));\n                vars.put(&quot;label&quot;,label.group(2));\n                break;\n            }\n        }\n    }\n}<\/code><\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u6b63\u898f\u8868\u73fe\u3067\u306f\u53d6\u5f97\u3057\u306b\u304f\u3001SELECT\u30bf\u30b0\u304c\u8907\u6570\u3042\u308b\u5834\u5408\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u5c5e\u6027\u306e\u53d6\u5f97\u65b9\u6cd5\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u307b\u304b\u306b\u3082\u826f\u3044\u65b9\u6cd5\u304c\u3042\u308b\u6c17\u304c\u3059\u308b\u306e\u3067\u3001\u3082\u3057\u3042\u308c\u3070\u30b3\u30e1\u30f3\u30c8\u3044\u305f\u3060\u3051\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\uff4d\uff4d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SELECT\u30bf\u30b0\u304c\u8907\u6570\u3042\u308a\u3001OPTION\u306e\u30d0\u30ea\u30e5\u30fc\u3092\u30e9\u30f3\u30c0\u30e0\u3067\u53d6\u308a\u305f\u3044\u5834\u5408\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002 \u60f3\u5b9a\u30b7\u30c1\u30e5\u30a8\u30fc\u30b7\u30e7\u30f3\u3068\u8ab2\u984c \u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001\u8907\u6570\u306eSELECT\u30bf\u30b0\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u5834\u5408\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002 \u60c5\u5831\uff21\u306b\u3064\u3044\u3066\u9078\u629e &lt;select name=&quot;infoA&quot;&gt; &#038;lt&#8230;<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/ptune.jp\/tech\/select-value-get\/\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":2,"featured_media":1805,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[8],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u30b7\u30ca\u30ea\u30aa\u4f5c\u6210#ex4_\u8907\u6570\u306eselect\u30bf\u30b0\u304b\u3089\u7279\u5b9a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b - pTune.jp<\/title>\n<meta name=\"description\" content=\"JMeter\u3067select\u30bf\u30b0\u306eOption\u5c5e\u6027\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u6b63\u898f\u8868\u73fe\u62bd\u51fa\u3067\u306f\u53d6\u5f97\u3057\u306b\u304f\u3044\u5834\u5408\u3082\u3001BeanShellPostProcessor\u3092\u4f7f\u3046\u3053\u3068\u3067\u60c5\u5831\u53d6\u5f97\u304c\u53ef\u80fd\u3067\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ptune.jp\/tech\/select-value-get\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u30b7\u30ca\u30ea\u30aa\u4f5c\u6210#ex4_\u8907\u6570\u306eselect\u30bf\u30b0\u304b\u3089\u7279\u5b9a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b - pTune.jp\" \/>\n<meta property=\"og:description\" content=\"JMeter\u3067select\u30bf\u30b0\u306eOption\u5c5e\u6027\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u6b63\u898f\u8868\u73fe\u62bd\u51fa\u3067\u306f\u53d6\u5f97\u3057\u306b\u304f\u3044\u5834\u5408\u3082\u3001BeanShellPostProcessor\u3092\u4f7f\u3046\u3053\u3068\u3067\u60c5\u5831\u53d6\u5f97\u304c\u53ef\u80fd\u3067\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ptune.jp\/tech\/select-value-get\/\" \/>\n<meta property=\"og:site_name\" content=\"pTune.jp\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-06T11:50:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-06T11:51:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ptune.jp\/tech\/wp-content\/uploads\/2023\/02\/\u8907\u6570SELECT.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2395\" \/>\n\t<meta property=\"og:image:height\" content=\"2013\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u63a8\u5b9a\u8aad\u66f8\u6642\u9593\" \/>\n\t<meta name=\"twitter:data1\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ptune.jp\/tech\/#website\",\"url\":\"https:\/\/ptune.jp\/tech\/\",\"name\":\"pTune.jp\",\"description\":\"\\u30c7\\u30a3\\u30fc\\u30cd\\u30c3\\u30c8\\u304c\\u8ca0\\u8377\\u30c6\\u30b9\\u30c8\\u3084JMeter\\u306e\\u4f7f\\u3044\\u65b9\\u306b\\u3064\\u3044\\u3066\\u306e\\u60c5\\u5831\\u3092\\u767a\\u4fe1\\u3057\\u3066\\u3044\\u307e\\u3059\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ptune.jp\/tech\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#primaryimage\",\"inLanguage\":\"ja\",\"url\":\"https:\/\/ptune.jp\/tech\/wp-content\/uploads\/2023\/02\/\\u8907\\u6570SELECT.png\",\"contentUrl\":\"https:\/\/ptune.jp\/tech\/wp-content\/uploads\/2023\/02\/\\u8907\\u6570SELECT.png\",\"width\":2395,\"height\":2013},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#webpage\",\"url\":\"https:\/\/ptune.jp\/tech\/select-value-get\/\",\"name\":\"\\u30b7\\u30ca\\u30ea\\u30aa\\u4f5c\\u6210#ex4_\\u8907\\u6570\\u306eselect\\u30bf\\u30b0\\u304b\\u3089\\u7279\\u5b9a\\u60c5\\u5831\\u3092\\u53d6\\u5f97\\u3059\\u308b - pTune.jp\",\"isPartOf\":{\"@id\":\"https:\/\/ptune.jp\/tech\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#primaryimage\"},\"datePublished\":\"2023-02-06T11:50:14+00:00\",\"dateModified\":\"2023-02-06T11:51:29+00:00\",\"author\":{\"@id\":\"https:\/\/ptune.jp\/tech\/#\/schema\/person\/2a166a5a51d8bf23ea6b328ba14a7fe0\"},\"description\":\"JMeter\\u3067select\\u30bf\\u30b0\\u306eOption\\u5c5e\\u6027\\u3092\\u53d6\\u5f97\\u3059\\u308b\\u65b9\\u6cd5\\u3092\\u307e\\u3068\\u3081\\u307e\\u3057\\u305f\\u3002\\u6b63\\u898f\\u8868\\u73fe\\u62bd\\u51fa\\u3067\\u306f\\u53d6\\u5f97\\u3057\\u306b\\u304f\\u3044\\u5834\\u5408\\u3082\\u3001BeanShellPostProcessor\\u3092\\u4f7f\\u3046\\u3053\\u3068\\u3067\\u60c5\\u5831\\u53d6\\u5f97\\u304c\\u53ef\\u80fd\\u3067\\u3059\\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ptune.jp\/tech\/select-value-get\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ptune.jp\/tech\/\",\"url\":\"https:\/\/ptune.jp\/tech\/\",\"name\":\"\\u30db\\u30fc\\u30e0\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@id\":\"https:\/\/ptune.jp\/tech\/select-value-get\/#webpage\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ptune.jp\/tech\/#\/schema\/person\/2a166a5a51d8bf23ea6b328ba14a7fe0\",\"name\":\"\\u6d45\\u898b \\u76f4\\u4eba\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ptune.jp\/tech\/#personlogo\",\"inLanguage\":\"ja\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7975f2b224ebcb60f67b80c232d9e6f7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7975f2b224ebcb60f67b80c232d9e6f7?s=96&d=mm&r=g\",\"caption\":\"\\u6d45\\u898b \\u76f4\\u4eba\"},\"url\":\"https:\/\/ptune.jp\/tech\/author\/azami\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_featured_media_url":"https:\/\/ptune.jp\/tech\/wp-content\/uploads\/2023\/02\/\u8907\u6570SELECT.png","jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/posts\/1788"}],"collection":[{"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/comments?post=1788"}],"version-history":[{"count":13,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/posts\/1788\/revisions"}],"predecessor-version":[{"id":1803,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/posts\/1788\/revisions\/1803"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/media\/1805"}],"wp:attachment":[{"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/media?parent=1788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/categories?post=1788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ptune.jp\/tech\/wp-json\/wp\/v2\/tags?post=1788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}