$re = '/(?:\b(?!e|cg)|(?<=\d)\D)[A-Za-z]?(\d+)/m';
$str = 'Edit 398e997979 the Expression 9798729889 & T900980980098ext to see e081815 matches. Roll over matches or e081815 the expression e081815 for details.e081815 PCRE & JavaScript flavors of RegEx are e081815 supported. Validate your expression with Tests mode e081815.
For e.g. cg636553 OR cg(any digits).
Now, I want that, all the digits except some patterns like e074663 OR e123444 OR e7736 should be excluded from the match.';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php