^[1-9]\d{0,3}(\.(0|[1-9]\d{0,3})){3}$
See here for an annotated explanation of how it works :) http://regex101.com/r/gS4eL0
Domanda
How would one go about writing a data annotation regex for the following?
Valid strings:
12.3.4567.0
1.1456.0.8321
4.1200.10.5
P.S. I'm not a Regex guru, and I don't know if the above is doable.
Soluzione
^[1-9]\d{0,3}(\.(0|[1-9]\d{0,3})){3}$
See here for an annotated explanation of how it works :) http://regex101.com/r/gS4eL0