<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>GARAPON</author_name>
  <author_url>https://blog.hatena.ne.jp/GARAPON/</author_url>
  <blog_title>自分の仕事を憎むには人生は余りにも短い</blog_title>
  <blog_url>https://garapon.hatenablog.com/</blog_url>
  <categories>
    <anon>正規表現</anon>
    <anon>Java</anon>
  </categories>
  <description>Javaの正規表現はエスケープする時にちょっと特殊なのでメモ。 正規表現の特殊文字をエスケープするには「￥」を使います。 たとえば「penta.」を「penta!!」に置換しようとた場合viなら「s/\./!!/」と書きます。が、Javaで同じように &quot;penta.&quot;.replaceAll(&quot;\.&quot;,&quot;!!&quot;); とするとコンパイルエラーになります。これは「￥.」なんて文字ねーよとコンパイラが怒ってるから。なので &quot;penta.&quot;.replaceAll(&quot;\\.&quot;,&quot;!!&quot;); と「\\」ってしてあげないと駄目。リテラルとしてのエスケープ＋正規表現のエスケープで2回エスケープしてあげないとって…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fgarapon.hatenablog.com%2Fentry%2F20071014%2F1192372424&quot; title=&quot;Javaの正規表現でエスケープ - 自分の仕事を憎むには人生は余りにも短い&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>2007-10-14 23:33:44</published>
  <title>Javaの正規表現でエスケープ</title>
  <type>rich</type>
  <url>https://garapon.hatenablog.com/entry/20071014/1192372424</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
