title: Powershell multiline regex: subtitles , How?
body: <p>At this website: <a href="http://softwarerecipes.blogspot.com/2011/01/powershell-script-for-fixing-subtitles.html" rel="nofollow">http://softwarerecipes.blogspot.com/2011/01/powershell-script-for-fixing-subtitles.html</a>.
  there is script for fixing  offset of subtitles files like this:</p>
  
  <p>SrtFixer.ps1 -Path 'Movie.srt' -Offset '-00:00:26.700'  but isn't available.</p>
  
  <p>So i found a script in C# ( here: <a href="http://www.codeproject.com/Articles/32834/Subtitle-Synchronization-with-C" rel="nofollow">http://www.codeproject.com/Articles/32834/Subtitle-Synchronization-with-C</a>)</p>
  
  <p>My first step is to write the right regex for the following structure :</p>
  
  <pre><code>2
  00:00:01,775 --&gt; 00:00:04,528
  - I want you to admit what you are.
  - You still refuse to see
  </code></pre>
  
  <p>I'll try this:</p>
  
  <pre><code>$file = "D:\subtitles\Hannibal - 02x10 - eng.srt"
  
  $regex ='(?m)[0-9]{1,5}\n([0-9]{2}:[0-9]{2}:[0-9]{2}),([0-9]{3}) --&gt; ([0-9]{2}:[0-9]  {2}:[0-9]{2}),([0-9]{3})\n((.+\n)*)'
  
  $text =get-content($file) -Raw
  
  $text | Select-String $regex -AllMatches |
      Foreach {$_.Matches} | Foreach {$_.Value}
  </code></pre>
  
  <p>The regex seems correct (regexhero) but not any matches.</p>
  
  <p>Can you help me ?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My mistake. The correct regex</p>
  
  <pre><code>$regex ='(?m)[0-9]{1,5}\n([0-9]{2}:[0-9]{2}:[0-9]{2}),([0-9]{3})\s--&gt;\s([0-9]{2}:[0-9]{2}:[0-9]{2}),([0-9]{3})\n((.+\n)*)'
  </code></pre>
  
  <p>but it doesn't work.</p>