I was importing string values and needed to check that it was a positive number

Heres a simple regex to check this. This example will only work for positive integers.


"123abc" !~ /\D/ # => false
"123" !~ /\D/ # => true


Related External Links: