<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hayataka2049</author_name>
  <author_url>https://blog.hatena.ne.jp/hayataka2049/</author_url>
  <blog_title>静かなる名辞</blog_title>
  <blog_url>https://hayataka2049.hatenablog.jp/</blog_url>
  <categories>
    <anon>python</anon>
    <anon>Tips</anon>
    <anon>正規表現</anon>
  </categories>
  <description>概要 pythonの正規表現モジュールreでは、デフォルトでは^は「文字列の先頭」に、$は「文字列の末尾」にマッチします。 なので、次のような挙動になります。 &gt;&gt;&gt; s = &quot;hoge\nfuga\n&quot; &gt;&gt;&gt; import re &gt;&gt;&gt; re.findall(r&quot;^[hf]|[ea]$&quot;, s) ['h', 'a'] # ['h', 'e', 'f', 'a']を期待 意図している結果と違うので、ちょっと残念な感じです。 対処法 reモジュールの関数にはflagsという引数を渡すことができます。flagsは実際には正規表現モジュールで定義されている定数で、ビットOR演算子（|）で連結するこ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhayataka2049.hatenablog.jp%2Fentry%2F2019%2F07%2F03%2F221907&quot; title=&quot;【python】正規表現モジュールreで行頭・行末にマッチしないときの対処 - 静かなる名辞&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-07-03 22:19:07</published>
  <title>【python】正規表現モジュールreで行頭・行末にマッチしないときの対処</title>
  <type>rich</type>
  <url>https://hayataka2049.hatenablog.jp/entry/2019/07/03/221907</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
