No problem. I know it's splitting a fine hair, but I thought I'd mention it.

FWIW, that article is a bit vague, but I think it applies to the case where there is a list of random keywords. But, in the set of data being searched here with clear patterns of com1-com9 and lpt1-lpt9, I'd wager that regex is faster than indexOf(). And it takes up less memory.