title: Regex works on Regexpal but not on Java
body: <p><strong>Note: I just learned Regex so it is likely to be a crappy pattern</strong></p>
  
  <p>I hacked up this regex</p>
  
  <pre><code>Begin VB\.Label\s+([^\s]+)\s+.+\s+Caption\s+=\s*("([^"]+)")\s+.+\s+Index\s+=\s*([0-9]+)
  </code></pre>
  
  <p>to match these form controls in a VB6 .frm file</p>
  
  <pre><code>         Begin VB.Label lblError 
          AutoSize        =   -1  'True
          Caption         =   "Blah blah"
          Height          =   195
          Index           =   49
          Left            =   105
          TabIndex        =   31
          Top             =   3135
          Width           =   4455
       End
  </code></pre>
  
  <p>When I tested it on Regexpal, it worked fine
  <img src="https://i.imgur.com/Lq7TC.jpg" alt="regexpal"></p>
  
  <p>but <code>matcher.find()</code> only finds completely garbage string</p>
  
  <pre><code>Error [&amp;About] - "&amp;About"
  </code></pre>
  
  <p>This is my escaped Java matcher</p>
  
  <pre><code>Pattern pat = Pattern.compile("Begin VB\\.Label\\s+([^\\s]+)\\s+.+\\s+Caption\\s+=\\s+(\"([^\"]+)\")\\s+.+\\s+Index\\s+=\\s+([0-9]+)");
  </code></pre>
  
  <p>EDIT: This is what actually matches:</p>
  
  <pre><code>      Begin VB.Menu mnuHelp 
       Caption         =   "&amp;About"
       Index           =   5
    End
  </code></pre>