Answer

said
about 3 years ago

Hi Saul,

You can use the .match formula together with a regex (regular expression).

The formula .match checks if your data pill contains a certain pattern (which can be a regex, or a string). If there is a match, the formula will evaluate to true, if not, false.

The formula will look like this: <data pill>.match?(/^[0-9]+$/).

Using this formula, if your data pill only contains digits, it will evaluate to true, and if it contains characters other than digits, it will evalute to false.

Try it out and let us know if it works.

Thanks!

Send us a ticket, we will try our best to assist you with your problem

## Saul Macht

## What formula can I use to check if a string is entirely digits?

As mentioned in the title, what formula can I use to check if a string is entirely digits?

CJ Weesaid about 3 years agoHi Saul,

You can use the .match formula together with a regex (regular expression).

The formula .match checks if your data pill contains a certain pattern (which can be a regex, or a string). If there is a match, the formula will evaluate to true, if not, false.

The formula will look like this: <data pill>.match?(/^[0-9]+$/).

Using this formula, if your data pill only contains digits, it will evaluate to true, and if it contains characters other than digits, it will evalute to false.

Try it out and let us know if it works.

Thanks!