title: How to validate that value is an Integer with Firebase rules
body: <p>I'm trying to make sure that some field of an object in firebase is an integer and not decimal. There is a method <a href="https://firebase.google.com/docs/reference/security/database/#isnumber" rel="nofollow noreferrer">isNumber()</a> but it returns true wheter value is an integer or a decimal.   </p>
  
  <p>I've tried to check a value with regex, but for some reason it works properly only with values within quotation marks ie strings.</p>
  
  <p>This is how my rule looks:</p>
  
  <pre><code>"$item_id":{
      "created":{
      ".validate":"newData.val().matches(/^[0-9]+$/)"
      }
  }  
  </code></pre>
  
  <p>So when I put an object with string value like this <code>{"created":"123456789"}</code> validation works fine. But when I put an object with number value <code>{"created":123456789}</code> validation fails.  </p>
  
  <p>Is there a way to do this?</p>