Trouble getting multiline working

your pattern basically says: find me 4 consecutive digits per line. The second line contains port number 3306 and will match.

Use the ^ operator at beginning of your regex. This changes your pattern to: find me 4 consecutive digits at beginning of line.

You can shorten the pattern into ^[0-9]{4}.