Question

I have a IPv4 address which should be compared against a pattern. A pattern can either be a specific address maybe containing wildcards or a dns.

  • *
  • ..*.*
  • 192.168.*.5
  • 206.0.3.4-25
  • 45.30.9.101
  • www.google.de

I already figured out that the InetAddress/Inet4Address class is the right one. But i cant figure out how to use it with both dns and wildcards. I get pattern and address as strings.

Was it helpful?

Solution

trying using a regular expression.

For numbers (\d{1,3},\d{1,3},\d{1,3},\d{1,3}) For domain, just google regular expression to match domain URL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top