in reply to Regex for IP and Optional Port
No one mentioned why yours didn't work. The only real problem is that the spaces in " to " don't match \w.