0*
to allow leading 0's.
After that you can have
1\d\d
or
2[0-4]\d
or
25[0-4]
or
\d\d
or
\d
so take all those possibilities and join them with |
0*(1\d\d|2[0-4]\d|25[0-4]|\d\d|\d)
If you call that (say) Q, then your fuller pattern becomes
((Q\.){3}Q)
Then if necessary you would put guards around it to ensure that it was not proceeded or followed by a digit or a period
