$re = '/((S|T)([a-zA-Z0-9]{9})|([0-3])(\d{8})([A-Z]))/';
$str = '000000000A
399999999Z
S000000000
TZZZZZZZZZ
T0GBA12348
A123456672
S201562837
201902938G
T19SS0110H
T19SS0025B
';
$subst = "";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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