$re = '/\b(S5TIME|S5T|TIME|LTIME|T|LT|D|TOD|LTOD|DT|DTL|LDT)#[0-9|+|-]*([^(\s|;)]+)/mi';
$str = 'DT#1990-01-01-00:00:00.000
DT#2089-12-31-23:59:59.999
LDT#1970-01-01-00:00:00.000000000
LDT#2262-04-11-23:47:16.854775807
DTL#1970-01-01-00:00:00.0
DTL#2262-04-11-23:47:16.854775807
LTOD#00:00:00.000000000
LTOD#23:59:59.999999999
TOD#00:00:00.000
TOD#23:59:59.999
D#1990-01-01
D#2169-06-06
LT#-106751d_23h_47m_16s_854ms_775us_808ns
LT#+106751d_23h_47m_16s_854ms_775us_807ns
LT#11350d_20h_25m_14s_830ms_652us_315ns
LTIME#11350d_20h_25m_14s_830ms_652us_315ns;
T#-24d_20h_31m_23s_648ms
T#+24d_20h_31m_23s_647ms
T#10d_20h_30m_20s_630ms
TIME#10d_20h_30m_20s_630ms
S5T#0MS
S5T#2H_46M_30S_0MS
S5T#10s
S5TIME#10s';
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