If you do not need to consider IPv6, you only need numeric IP addresses without port numbers and you do not need to check addresses (i.e. do not match illegal address strings 321.456.299.999), then you can use
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
If you need to do any of the above, please update your question.
source
share