title: PHP / Regex: extract string from string
body: <p>I just started using PHP and hope someone here can help me with this. </p>
  
  <p>I am trying to extract a string ("<code>myRegion</code>") from another string ("<code>mainString</code>") where my string always starts with "<code>myCountry:</code> " and ends with a semicolon (<code>;</code>) if the main string contains more countries after myCountry OR without anything if the main string does not contain more countries after it. </p>
  
  <p><strong>Examples to show different options for main string:</strong> </p>
  
  <ul>
  <li>myCountry: <strong>region1, region2</strong></li>
  <li>myCountry: <strong>region1, region2, region3</strong>; otherCountry: region1</li>
  <li>otherCountry: region1; myCountry: <strong>region1</strong>; otherCountry: region1, region2</li>
  </ul>
  
  <p>What I want to extract is always the part in bold. </p>
  
  <p><strong>I was thinking of something like the following but this doesn't look right yet:</strong> </p>
  
  <pre><code>$myRegions = strstr($mainString, $myCountry);                   
  $myRegions = str_replace($myCountry . ": ", "", $myRegions);
  $myRegions = substr($myRegions, 0, strpos($myRegions, ";"));
  </code></pre>
  
  <p>Many thanks in advance for any help with this, Mike. </p>