title: Java Regex Find Characters In Any String
body: <p>I'm trying to program a Minecraft Bukkit plugin using Java that will find when an IP is placed in the chat, so I'm using regex for it. What I need is regex to find anywhere in the string, a character followed by a period followed by another character, such as <code>127.0.0.1</code> being valid, but it also needs to be able to find it with any characters surrounding it such as <code>This IP: 127.0.0.1 is your localhost IP</code>. This is my current code:</p>
  
  <pre><code>Pattern p = Pattern.compile("[a-z1-9]" + "." + "[a-z1-9]");
  Matcher matcher = p.matcher(message);
  if(matcher.matches()){
      player.sendMessage(plugin.prefix + "§7You cannot advertise an IP address!");
      event.setCancelled(true);
  }
  </code></pre>
  
  <p>This code will only search for something like <code>127.0</code> and only that, but as I said above I need it to find any amount of <code>[letter/number].[letter/number]</code> in any string, if that made sense.</p>