I need to apply validation on input time intervals that are taken in as seconds. Now i am not really good at Regular expressions. So can any body help making a regular expression that can test whether a number is divisible by 60.
I was wondering if i could use to test one that check that the number is divisible by 10 and then check whether the same is divisible by 6.
For number divisible by 10 here [\d*0] is the expression i guess. Please correct me if i am wrong.
Hope somebody solves my problem.
Thanks
For a number to be divisible by 60, it must be divisible by 2, 3 and 10. Therefore: If the sum of digits of number is not divisible by 3, or. If there is no digits which is divisible by 2, or.
Divisibility by 7 can be checked by a recursive method. A number of the form 10a + b is divisible by 7 if and only if a – 2b is divisible by 7. In other words, subtract twice the last digit from the number formed by the remaining digits. Continue to do this until a small number.
Why not do N % 60
?
Why you want to use regex for a job which can easily be done using one operator ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With