<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hepokon365</author_name>
  <author_url>https://blog.hatena.ne.jp/hepokon365/</author_url>
  <blog_title>毎日へっぽこ</blog_title>
  <blog_url>https://hepokon365.hatenablog.com/</blog_url>
  <categories>
    <anon>Java</anon>
    <anon>Groovy</anon>
    <anon>Kotlin</anon>
  </categories>
  <description>タイトル通りだが、チーム内の誰もできるということを知らなかったのでメモ。 replaceAllでの後方参照 Groovyの場合 Kotlinの場合 振り返り replaceAllでの後方参照 タイトル通り、第1引数の検索文字列に ( ～ ) で囲んだグループを記述し、第2引数の置換文字列に ${n} や $n を記述すると、検索文字内のグループ化した文字列を後方参照できる。 また、 String#replaceFirst でも同様に置換可能。 assert &quot;abc&quot;.replaceAll(&quot;(^.)&quot;, &quot;$1$1&quot;).equals(&quot;aabc&quot;); assert &quot;abc&quot;.replace…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhepokon365.hatenablog.com%2Fentry%2F2022%2F03%2F27%2F234633&quot; title=&quot;JavaのString#replaceAllによる正規表現置換でも、$1などでグループ化した文字列を後方参照できる - 毎日へっぽこ&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>2022-03-27 23:46:33</published>
  <title>JavaのString#replaceAllによる正規表現置換でも、$1などでグループ化した文字列を後方参照できる</title>
  <type>rich</type>
  <url>https://hepokon365.hatenablog.com/entry/2022/03/27/234633</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
