Use the ranges defined in the RFC (as suggested by Anders); than use regular expression to detect/remove the private IP address from the list. Here is a sample RegEx to detect private IP addresses. (Not tested by me)

Find out what your public IPv4 and IPv6 address is revealing about you! My IP address information shows your location; city, region, country, ISP and location on a map. Many proxy servers, VPNs, and Tor exit nodes give themselves away. How to Check Public IP Address Using Command Line In Oct 17, 2019 How to Check IP Address in Ubuntu Linux [Quick Tip] Apr 10, 2020

Private IP vs Public IP Address? What is the Difference

How to find someone private ip address - Quora If you know some person and you want to find their private IP address you can in general not do that. However, if they send you a data packet you get it as the "from" address immediately. However, that may not be what you mean by "private IP addre What is the difference between public and private IP address? Nov 18, 2018

5 Ways to Find the IP Address of Your PC - wikiHow

For Private IP (or IPv4 Private IP), enter the primary private IPv4 address. If you don't specify an IPv4 address, we select an available private IPv4 address from within the selected subnet. The Source/Destination Check attribute controls whether source/destination checking is enabled on the instance. Disabling this attribute enables an How to trace a private IP Address location?