The number of single ports is unlimited, the number of range groups is unlimited, but expected to come after the single ports.
Range groups are intended to be separated by a dash
No spaces / other chars are allowed.
Port numbers (single or in range) are limited from 1 to 65535
A small number is allowed as the second argument in a range, this is not easily fixed in the regex, but we might be able to flip them round in the boefje code.
(([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-4]),)*?(([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-4])-)?([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])
This will match the following:
Rules:
Originally posted by @underdarknl in https://github.com/minvws/nl-kat-coordination/issues/2999#issuecomment-2177941702