I haven\'t used regular expressions soo much, so I\'m having difficulty . I want regex that only validates that the field contains digits, but that does not care about how many.
It's OK. You can just use ^\d+$
for all it matters anyway.
Yes, this regex is perfectly valid and does what you think it does, although if your regex engine supports this you could use \d
, whichs stands for [0-9]
.
A simpler regex would be to invert your match and check for non-digit numbers: \D
.