I have a variable list of number (switch ports) that I need to build into a string that indicates which ports should be "included" and which should be "excluded". Here is an example of the required format:
(Port 1[!(0-2 | 4-9)] | Port 4[!(0-3 | 5)])*
In this example, if my numbers are 1-19 and 40-45, then Port 1, Port 3, and Port 44 will be included while ports 10-12, 14-19, 40-43, and 45 will be excluded.
I do not know, in advance, what numbers will be present in the port list. How can I build this expression?