Matching number with regex
Need a single combined regex to match the following logic: The number should be 8 digits long, the 8th digit should be the remainder of (the first 7 digits / 7).
for example: 86008786
remainder = (the first 7 digit)/ 7 = 8600878 / 7 = 6
so the 8 digit 86008786 is valid number.
is it doable with regex?
It is not doable with regex. You cannot do math operations. It might be possible with a unary number, but would require a conversion and would be inefficient.