I'm trying to create a regular expression in Java to validate a number with the following constraints:
- The number can be of any length but can only contain digits
- First digit can be 0 - 9
- Subsequent digits can be 0 - 9, but one of the digits must be non-zero.
For example: 042004359 is valid, but 0000000000 is not.
0valid? You say that the number can be any length and the first digit can be 0-9, and apply the restriction that "one of the digits must be non-zero" in the sentence referring to "subsequent digits", but it seems likely you intended that no all-zero number would be valid.