<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>HK29</author_name>
  <author_url>https://blog.hatena.ne.jp/HK29/</author_url>
  <blog_title>PythonとVBAで世の中を便利にする</blog_title>
  <blog_url>https://hk29.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>抽出</anon>
  </categories>
  <description>'20/09/12更新：雛形コードの汎用性を高めました。 文字列を検出するには、正規表現reモジュールを使用します。・先頭文字列をマッチさせたい場合は re.match()・文字列の一部を部分マッチさせたい場合は re.search() 本コードの実施例を示します。下図は抽出対象のテキストファイルです。 下図は、本コードを実行して生成したテキストファイルです。検出したい文字列をリストで['NAME ID', 'D']と指定するだけで、その開始文字列と終了文字列の行を抽出して、その行区間のデータを新たなテキストファイルへ書き出します。 その他の指定方法による結果例が次の3つです。一番左図は、「m…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhk29.hatenablog.jp%2Fentry%2F2018%2F08%2F16%2F174030&quot; title=&quot;Python 指定文字列をファイル内で検出して開始行と終了行を取得する。そして、その区間の複数行を抽出する。正規表現「re」 - PythonとVBAで世の中を便利にする&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/H/HK29/20180816/20180816164030.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-08-16 17:40:30</published>
  <title>Python 指定文字列をファイル内で検出して開始行と終了行を取得する。そして、その区間の複数行を抽出する。正規表現「re」</title>
  <type>rich</type>
  <url>https://hk29.hatenablog.jp/entry/2018/08/16/174030</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
