title: Regular Expression negate whole regex
body: <p>I want to parse this String with a regular expression into groups:</p>
  
  <pre><code>{4: :35B:ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (HSBC T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word :16S:CONFDET :16R:SETDET :22F::SETR//TRAD :11A::FXIB//EUR :16R:AMT :19A::DEAL//EUR222, :16S:AMT :16R:AMT :19A::LOCO//EUR555 :16S:AMT :16R:AMT :19A::OTHR//EUR444 :16S:AMT :16R:AMT :19A::SETT//EUR333,33 :16S:AMT :16S:SETDET -}
  </code></pre>
  
  <p>I created this regex <code>(:\d\d[a-zA-Z]:*(\w*\/\/)?|:\d\d:)([^:]+)</code>
  It matches in most of the cases, but not in this one. 
  I want to extract Groups like this:</p>
  
  <pre><code>:35B: =&gt; ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (XXXX T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word
  
  :16S: =&gt; CONFDET
  
  :16R: =&gt; SETDET
  </code></pre>
  
  <p>...</p>
  
  <p>I expected that there is no ':' in the second group. Maybe someone can help me. I need to extact the whole Sting until the next :\d\d\w: Block.</p>
  
  <p>Edit: The input String has a key-value Structure. For example :35B: is the key and everything behind until the next key is the value (in the case of the example the value is 'ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (XXXX T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word').
  I want to extract the key-value pairs of the input string. Here is a small code example of what i want:</p>
  
  <pre><code>CharSequence swiftMessage = "{4: :35B:ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (HSBC T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word :16S:CONFDET :16R:SETDET :22F::SETR//TRAD :11A::FXIB//EUR :16R:AMT :19A::DEAL//EUR222, :16S:AMT :16R:AMT :19A::LOCO//EUR555 :16S:AMT :16R:AMT :19A::OTHR//EUR444 :16S:AMT :16R:AMT :19A::SETT//EUR333,33 :16S:AMT :16S:SETDET -}";
  
  Pattern pattern = Pattern.compile("(:\\d\\d([a-zA-Z]):*(\\w*//)?|:\\d\\d:)([^:]+)");
  Matcher matcher = pattern.matcher(swiftMessage);
  
  while( matcher.find() ) {
      String key = matcher.group(1);
      String value = matcher.group(4);
  
      System.out.println(key + "=&gt;" + value);
  
  }
  </code></pre>
  
  <p>Expected Output (the stucture is key=>value):</p>
  
  <pre><code>:35B:=&gt;ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (HSBC T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word
  :16S:=&gt;CONFDET 
  :16R:=&gt;SETDET 
  :22F::SETR//=&gt;TRAD 
  :11A::FXIB//=&gt;EUR 
  :16R:=&gt;AMT 
  :19A::DEAL//=&gt;EUR222, 
  :16S:=&gt;AMT 
  :16R:=&gt;AMT 
  :19A::LOCO//=&gt;EUR555 
  :16S:=&gt;AMT 
  :16R:=&gt;AMT 
  :19A::OTHR//=&gt;EUR444 
  :16S:=&gt;AMT 
  :16R:=&gt;AMT 
  :19A::SETT//=&gt;EUR333,33 
  :16S:=&gt;AMT 
  :16S:=&gt;SETDET -}
  </code></pre>
  
  <p>In my regex the value of the key :35B: is 'ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (HSBC T R.? B.) /F' because my regex looks for the next colon. The expexted value should be 'ISIN DE000XXXXXXX DISC.Z 11.11.11 XXXX90 1234 (HSBC T R.? B.) /F:12345/R:N/W:N/C:N/S:N/G:N/A:N/F:N /XX/Any Word'</p>
  
  <p>Hopefully now it's better to understand.</p>