title: Whats the difference between [\s\S]*? and .*? in Java regular expressions?
body: <p>I have developed a regular expression to identify a block of xml inside a text file. The expression looks like this (I have removed all java escape slashes to make it read easy):</p>
  
  <pre><code>&lt;\?xml\s+version="[\d\.]+"\s*\?&gt;\s*&lt;\s*rdf:RDF[^&gt;]*&gt;[\s\S]*?&lt;\s*\/\s*rdf:RDF\s*&gt;
  </code></pre>
  
  <p>Then I optimised it and replaced <code>[\s\S]*?</code> with <code>.*?</code> It suddenly stopped recognising the xml. </p>
  
  <p>As far as I know, <code>\s</code> means all white-space symbols and <code>\S</code> means all non white-spaced symbols or <code>[^\s]</code> so <code>[\s\S]</code> logically should be equivalent to <code>.</code> I didn't use greedy filters, so what could be the difference?</p>