title: find if a string ends with semicolon or a word
body: <p>I need a regex to determine if a string ends with semicolon or "BEGIN" or "THEN". Also before BEGIN and THEN words, there must be a white space or line break character. </p>
  
  <pre><code>if(strLineText.matches(";|THEN|BEGIN$"))
  </code></pre>
  
  <p>This works for THEN and BEGIN but not for semicolon. And also with this regex I could not determine if THEN and BEGIN are exact words.</p>