I made a regex for port numbers (before you say this is stupid, its going into a bigger regex for URL's which is much harder than it sounds).
My coworker said this is really bad and isnt going to catch everything. I told him no way! This thing catches everything from 0 to 65535 and NOTHING ELSE. Someone confirm this for me or my coworker? BTW: Never search for regex's online. I found so many that would get me 'every port from 0 to 65536' PORT 65536!!! i'ma go run my server on 65536 guys just connect later
BAD FORMAT - Made for computers (one line) :
/(^[0-9]$)|(^[0-9][0-9]$)|(^[0-9][0-9][0-9]$)|(^[0-9][0-9][0-9][0-9]$)|((^[0-5][0-9][0-9][0-9][0-9]$)|(^6[0-4][0-9][0-9][0-9]$)|(^65[0-4][0-9][0-9]$)|(^655[0-2][0-9]$)|(^6553[0-5]$))/
HUMAN READABLE:
/(^[0-9]$)| #single digit
(^[0-9][0-9]$)| #two digit
(^[0-9][0-9][0-9]$)| #three digit
(^[0-9][0-9][0-9][0-9]$)| #four digit
((^[0-5][0-9][0-9][0-9][0-9]$)| #five digit (up to 59999)
(^6[0-4][0-9][0-9][0-9]$)| # (up to 64999)
(^65[0-4][0-9][0-9]$)| # (up to 65499)
(^655[0-2][0-9]$)| # (up to 65529)
(^6553[0-5]$))/ # (up to 65535)
who can deny my power?