Can someone help me create this regex. I need it to check to see if the string is either entirely whitespace(empty) or if it only contains positive whole numbers. If anything el
To match a number or empty string '' i.e the user has not entered any input do this
(^[0-9]+$|^$)
To match a number, an empty string, or a white space character
(^[0-9]+$|^$|^\s$)
Test this on regex101