<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>round-rand</author_name>
  <author_url>https://blog.hatena.ne.jp/round-rand/</author_url>
  <blog_title>ランドML</blog_title>
  <blog_url>https://ml-rand-note.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>slice 数字を指定する場合 str[a, b] str.slice(a, b) は同じ意味 str = &quot;hello&quot; # 2文字目から3文字取り出す p str[2, 3] #=&gt; &quot;llo&quot; p str.slice(2, 3) #=&gt; &quot;llo&quot; 正規表現指定の場合 正規表現に一致する最初の箇所を文字列として返す。 str = &quot;12hello34&quot; # 数字が連続している箇所を抜き出す p str.slice(/\d+/) #=&gt; &quot;12&quot; # 数字 + アルファベットの箇所を抜き出す p str.slice(/\d[a-z]/) #=&gt; &quot;2h&quot; scan 正規表現に一致した全ての…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fml-rand-note.hatenablog.com%2Fentry%2Fruby%2Fstring-extraction&quot; title=&quot;【Ruby】文字列　抽出メソッド - ランドML&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>2026-07-27 00:00:00</published>
  <title>【Ruby】文字列　抽出メソッド</title>
  <type>rich</type>
  <url>https://ml-rand-note.hatenablog.com/entry/ruby/string-extraction</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
