regexp to match xxx.xxx.xxx?
===

I need to check input with preg_match, which must be of this format: xxx.xxx.xxx
The number of block can vary... These are all examples of valid inputs:

    001
    00a.00a
    0fg.001
    aaa.aaa.001
    001.001.002.001.001.001

Well I could probably write a regexp something like:

    ^([\da-z]{3}\.?)+$

But here comes the problem with the quantifier of the period. I mean if I use '?' to match 0 or 1 times, it would also match even if skip the dots somewhere, eg:

    000.001.0010az001

then, if I used {1} to match one time, it would match nothing, because the last block does not have a dot.

So I can't think what to think of... Please advice