<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yucatio</author_name>
  <author_url>https://blog.hatena.ne.jp/yucatio/</author_url>
  <blog_title>yucatio@システムエンジニア</blog_title>
  <blog_url>https://yucatio.hatenablog.com/</blog_url>
  <categories>
    <anon>Firebase</anon>
  </categories>
  <description>Firestoreのセキュリティルールでは、文字列を正規表現で制限することができます。悪意のあるユーザにおかしな値を登録されないようアプリと同じ制限をかけておきましょう。 String.matches(regex) String.matchesを使うと、フィールドに登録される値が 指定された正規表現を満たす場合にのみ、DBに登録することができます。 記述はこのようになります。 // 電話番号（ハイフンなし） allow create, update: if request.resource.data.tel.matches(&quot;^0[0-9]{9,10}$&quot;) // メールアドレスっぽい文字列 …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyucatio.hatenablog.com%2Fentry%2F2021%2F10%2F26%2F180115&quot; title=&quot;Firestoreで文字列を正規表現で制限するセキュリティルール - yucatio@システムエンジニア&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>https://cdn-ak.f.st-hatena.com/images/fotolife/y/yucatio/20211026/20211026132400.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-10-26 18:01:15</published>
  <title>Firestoreで文字列を正規表現で制限するセキュリティルール</title>
  <type>rich</type>
  <url>https://yucatio.hatenablog.com/entry/2021/10/26/180115</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
