title: Regex pattern to match Switch Case statements
body: <p>We need to identify and then process switch/case statements in code based on some business rules.<br /></p>
  
  <p>A typical switch statement:</p>
  
  <p><code>
      switch (a)<br />
              { <br />
                  case "A": <br />
                  case "B": <br />
                      result = "T"; <br />
                      result1 = "F";<br />
                  default: result = "F";<br />
              }
  </code></p>
  
  <p>I have been able to create two patterns to match the switch body in the first step and the case labels and body in the second step, however I am looking for a single regex which will allow me to extract case labels and bodies.</p>
  
  <p>We do not have nested switches.</p>
  
  <p>Kind regards,</p>