title: PHP preg_match how to grep string between underscores
body: <p>I have this string:</p>
  
  <p><code>mctrn_25595_AdvandSurthree</code></p>
  
  <p>and want to parse it to extract the number <code>25595</code> into one variable and basically anything behind <code>25595_</code> into another variable.</p>
  
  <pre><code>$scriptBasename = $_SERVER['SCRIPT_FILENAME'];
  $scriptBasename = basename($scriptBasename);
  $cuttedName = preg_replace( '/^mctrn_/', '' , $scriptBasename );
  $port= preg_match('/[0-9]+/','',$scriptBasename);
  $serverName= preg_match('/_"(.*)/','',$cuttedName);
  
  echo($scriptBasename."\r\n"); 
  echo($port."\r\n"); 
  echo($serverName."\r\n");
  </code></pre>
  
  <p>The result from my command line:</p>
  
  <pre><code>php mctrn_25595_AdvandSurthree.php  &lt;&lt;&lt; script filename!
  PHP Notice:  Array to string conversion in /home/bent/Downloads/mctrn_25595_AdvandSurthree.php on line 8
  Array
  0
  0
  </code></pre>
  
  <p>I am currently a PHP novice and yet failing to do "such simple stuff".</p>