<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hasegawayosuke</author_name>
  <author_url>https://blog.hatena.ne.jp/hasegawayosuke/</author_url>
  <blog_title>葉っぱ日記</blog_title>
  <blog_url>https://hasegawa.hatenablog.com/</blog_url>
  <categories>
    <anon>JavaScript</anon>
  </categories>
  <description>JavaScriptで switch( s.match( ... ) ){ case /abcd/ : break; case /defg/ : break; } みたいに、文字列 s が複数の正規表現のどのパターンと一致するのかを switch 文でわかりやすく書く方法を考えていて、一致したパターンの見た目の分かりやすさも考えると、if の羅列しかないのかなぁと思っていたけど、こんな感じでよさそうなので、忘れないようメモ。 switch( true ){ case /abcd/.test( s ) : break; case /defg/.test( s ) : break; } switc…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhasegawa.hatenablog.com%2Fentry%2F20091002%2Fp2&quot; title=&quot; JavaScriptで、複数の正規表現のどのパターンにマッチするかを switch で書く - 葉っぱ日記&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>2009-10-02 00:00:00</published>
  <title> JavaScriptで、複数の正規表現のどのパターンにマッチするかを switch で書く</title>
  <type>rich</type>
  <url>https://hasegawa.hatenablog.com/entry/20091002/p2</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
