title: Regular Expression to extract label-value pairs in Java
body: <p>I have a file containing several lines similar to:</p>
  
  <pre><code>Name: Peter
  Address: St. Serrano número 12, España
  Country: Spain
  </code></pre>
  
  <p>And I need to extract the address using a regular expression, taking into account that it can contain dots, special characters (ñ, ç), áéíóú...</p>
  
  <p>The current code works, but it looks quite ugly:.</p>
  
  <pre><code>Pattern p = Pattern.compile("^(.+?)Address: ([a-zA-Z0-9ñÑçÇáéíóú., ]+)(.+?)$",
                              Pattern.MULTILINE | Pattern.DOTALL);
  Matcher m = p.matcher(content);
  if (m.matches()) { ... }
  </code></pre>
  
  <p><strong>Edit: The Address field could also be divided into multiple lines</strong></p>
  
  <pre><code>Name: Peter
  Address: St. Serrano número 12,   
  Madrid
  España
  Country: Spain
  </code></pre>
  
  <p>Edit: I can't use a Properties object or a YAML parser, as the file contains other kind of information, too.</p>