<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>takuya_1st</author_name>
  <author_url>https://blog.hatena.ne.jp/takuya_1st/</author_url>
  <blog_title>それマグで！</blog_title>
  <blog_url>https://takuya-1st.hatenablog.jp/</blog_url>
  <categories>
    <anon>regex</anon>
    <anon>ruby</anon>
    <anon>php</anon>
    <anon>python</anon>
  </categories>
  <description>\K を使うと、そこまでのマッチ部を省略できる ip -br a からIPv4 を取り出す例 $ ip -br a | grep eth2 eth2 169.254.70.21/16 fe80::4154:6db4:aec3:32f/64 コレを、\k で書くとこうなる。 ip -br a | grep -oP 'eth2\s+\K[\d.]+' つまり、後方参照を使わなくても、「前読み」で戦えるわけだ。 php の例 これをphpで使うと。次の用になる。 before( グループ ) &lt;?php preg_match_all( '/^eth2\s+([\d.]+)/m', `ip -br a…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakuya-1st.hatenablog.jp%2Fentry%2F2024%2F05%2F20%2F121337&quot; title=&quot; 正規表現の\K で１つだけなら後方参照を省略できて便利 - それマグで！&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>2024-05-20 12:13:37</published>
  <title> 正規表現の\K で１つだけなら後方参照を省略できて便利</title>
  <type>rich</type>
  <url>https://takuya-1st.hatenablog.jp/entry/2024/05/20/121337</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
