title: Does Java regex optimize this specific case?
body: <p>I wonder how does regex work, my particular regex has an element that looks like this:</p>
  
  <p><code>(word1|word2|wordn......)</code></p>
  
  <p>The numbers of words is big <strong>several hundreds</strong>.<br>
  I wonder if the regex engine is just testing the words one by one or if it optimizes the search and it what way.<br>
  Any pointer to good documentation will be good.</p>