title: Remove string endings with regex and preg_replace
body: <p>I'm trying to do a simple replace. I try to understand regular expressions but it's like Chinese to me. I've read <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="nofollow">http://en.wikipedia.org/wiki/Regular_expression</a> but frankly that is still too complex for me to understand.</p>
  
  <p>I got the following 6 strings (each row is a separate variable):</p>
  
  <pre><code>$sampleArray[] = "Pyromancer 6,52 Pack - 19,99€";
  $sampleArray[] = "Dreadnought Pack - 36,99€";
  $sampleArray[] = "Citizen Pack - 45,99€";
  $sampleArray[] = "Colonies - Pyromancer Pack - ";
  $sampleArray[] = "Colonies - Dreadnought Pack - ";
  $sampleArray[] = "Colonies - Citizen Pack - ";
  
  foreach($sampleArray as $package_name) {
  
      $pattern = '/(\s-\s[0-9]+,[0-9]+€)|(\s-\s)$/';
      $package_name = preg_replace($pattern, '', $package_name);
      echo $package_name;
  }
  </code></pre>
  
  <p>The result that I want is to have the part at the end removed:</p>
  
  <pre><code>Pyromancer 6,52 Pack
  Dreadnought Pack
  Citizen Pack
  Colonies - Pyromancer Pack
  Colonies - Dreadnought Pack
  Colonies - Citizen Pack
  </code></pre>
  
  <p>What I tried through trial and error is:</p>
  
  <pre><code>$pattern = '([0-9]+,[0-9]+â‚¬)';
  $package_name = preg_replace($pattern, '', $package_name);
  
  $pattern = '( - )';
  $package_name = preg_replace($pattern, '', $package_name);
  echo $package_name;
  </code></pre>
  
  <p>This however gives me the following result:</p>
  
  <pre><code>Pyromancer 6,52 Pack
  Dreadnought Pack
  Citizen Pack
  ColoniesPyromancer Pack
  ColoniesDreadnought Pack
  ColoniesCitizen Pack
  </code></pre>
  
  <p>Anyone care to help me point out the final thing that I'm missing to only change the string at the end?</p>
  
  <p>Also is it possible to put this into one replace function instead of going through it multiple times?</p>
  
  <p>Update: I made a fiddle here: <a href="http://viper-7.com/1dXwXQ" rel="nofollow">http://viper-7.com/1dXwXQ</a></p>