We have this regex: \\*.*?(.600[0-9]).*?.(LISTEN|ESTABLISHED)
OS = Solaris 10
The purpose of this regex is to match the ports in output of "netstat -an" and report if any ports between 6000-6009 are getting used. The only problem is if I have something like this (sample output as mentioned below), the regex matches everything with 6000 in it. It matches 46000, 60006 and 6000. Because of that we are getting faulty alerts. How can we fix this to just ONLY pick up ports (6000-6009). Please help.
Thanks everyone for replying back on this thread. RudiC, you solution worked fine. I know regex is a bit tricky but we have this special need where we have to only use regex.