$re = '/M(\d{1,3})[-_]\d{1,4}(CCU?|)/m';
$str = 'DOA000281_ICS_U-Zero_R-M1-1740_W.TAB
DOA000281_ICS_U-Zero_R-M10-1740_W.TAB
DOA000281_ICS_U-Zero_R-M100-1740_W.TAB
DOA000281_ICS_U-Zero_R-M2-1740_W.TAB
DOA000281_ICS_U-Zero_R-M200-1740CCU_W.TAB
DOA000281_ICS_U-Zero_R-M200-1740_W.TAB
DOA000281_ICS_U-Zero_R-M30-1740CCU_W.TAB
DOA000281_ICS_U-Zero_R-M30-1740_W.TAB
DOA000281_ICS_U-Zero_R-M5-1740_W.TAB
DOA000281_ICS_U-Zero_R-M50-1740_W.TAB
DOA_000533_ICS_0y0w_100y360wMax.tab
DOA_000533_ICS_0y0w_10y360wMax.tab
DOA_000533_ICS_0y0w_1y360wMax.tab
DOA_000533_ICS_0y0w_200ccy360wMax.tab
DOA_000533_ICS_0y0w_200y360wMax.tab
DOA_000533_ICS_0y0w_2y360wMax.tab
DOA_000533_ICS_0y0w_30ccy360wMax.tab
DOA_000533_ICS_0y0w_30y360wMax.tab
DOA_000533_ICS_0y0w_50y360wMax.tab
DOA_000533_ICS_0y0w_5y360wMax.tab
CFA_AUG2018_2D DOA_000537_ICS_0y0w_100y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_10y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_1y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_200ccy600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_200y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_2y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_30ccy600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_30y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_50y600wMax.TAB
CFA_AUG2018_2D DOA_000537_ICS_0y0w_5y600wMax.TAB
DOA000557_ICS_U-Zero_R-M1-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M10-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M100-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M2-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M200-300CCU_W_2D.TAB
DOA000557_ICS_U-Zero_R-M200-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M30-300CCU_W_2D.TAB
DOA000557_ICS_U-Zero_R-M30-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M5-300_W_2D.TAB
DOA000557_ICS_U-Zero_R-M50-300_W_2D.TAB
DOA000616_617 ICS U-ZERO_R-M1-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M10-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M100-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M2-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M200-300CCU_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M200-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M30-300CCU_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M30-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M5-300_Winter.TAB
DOA000616_617 ICS U-ZERO_R-M50-300_Winter.TAB
DOA000674_ICS_U_Zero_R_M100_600_W.TAB
DOA000674_ICS_U_Zero_R_M10_600_W.TAB
DOA000674_ICS_U_Zero_R_M1_600_W.TAB
DOA000674_ICS_U_Zero_R_M200_600CCU_W.TAB
DOA000674_ICS_U_Zero_R_M200_600_W.TAB
DOA000674_ICS_U_Zero_R_M2_600_W.TAB
DOA000674_ICS_U_Zero_R_M30_600CCU_W.TAB
DOA000674_ICS_U_Zero_R_M30_600_W.TAB
DOA000674_ICS_U_Zero_R_M50_600_W.TAB
DOA000674_ICS_U_Zero_R_M5_600_W.TAB
DOA002372_ICS_U_Zero_R_M100_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M10_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M1_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M200_600CC_W_2D.TAB
DOA002372_ICS_U_Zero_R_M200_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M2_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M30_600CC_W_2D.TAB
DOA002372_ICS_U_Zero_R_M30_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M50_600_W_2D.TAB
DOA002372_ICS_U_Zero_R_M5_600_W_2D.TAB
';
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