Uh, the people suggesting logarithms are joking, right? I know premature optimization is bad, but there's no need to involve floating-point approximations(or other, probably more expensive implementations of 10-logarithms) where two integer comparisons would suffice and be clearer:
#define IS_SIX_DIGITS(x) ( x >= 100000 && x <= 999999 )
Of course, this assumes that "000042" is not supposed to be a six-digit number, even though it does match the regexp, but logarithms would be useless for checking any property in which, e.g., 000042 is not equivalent to 42, since log( 000042 ) = log( 42 ).