Regex Counting By 3s

Viewed 335

I'm teaching myself regular expressions, and found a quizzing site that has been helping me find more applications for them and has been helping me expand my knowledge of how they work.

I found a question asking me to form a regex to match 10 digit numbers that are multiples of 3s. The only way I can think of doing this is by having the regex recognise numbers' values and be able to manipulate them mathematically. How is this possible?

In other words, what regex would match

0003
0006
0351
1749

but not match

0005
0011
0361
4372
2 Answers
Related