fork download
  1. <?php
  2.  
  3. $re = '~\s+Cert Hash[^:]*:\s*((?:\s*[a-z0-9]{2})+)~';
  4. $str = " [staf] NotBefore: 1/11/2016 9:48 AM\n [staf] NotAfter: 1/11/2024 9:48 AM\n [staf] Subject: CN=My Root CA, O=Experian, OU=Hunter, L=Sofia, S=CA, C=BG\n [staf] Signature matches Public Key\n [staf] Root Certificate: Subject matches Issuer\n [staf] Template:\n [staf] Cert Hash(sha1): e6 c4 aa 7a 7d 11 3d c2 6c cb 6e 3f b5 bc 61 27 e8\n67 2c f7\n [staf] Key Container = 9c4336e8-9450-46b8-9bdc-cf70faafb29a\n [staf] Unique container name: 2d800c871d70eba035d4612cdd5d1a61_48982b62-3";
  5. preg_match($re, $str, $match);
  6. echo preg_replace('~\s*~', '', $match[1]);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
e6c4aa7a7d113dc26ccb6e3fb5bc6127e8672cf7