fork download
  1. import re
  2.  
  3. list_1 = ['29','560001','08067739333','560037002','29AAACC0462F1Z0','55XX1XXX19','07S23X09','98561XXX1X9']
  4.  
  5. rx = re.compile('[0-9X]+')
  6.  
  7. print ( [x for x in list_1 if rx.fullmatch(x)] )
Success #stdin #stdout 0.02s 9508KB
stdin
Standard input is empty
stdout
['29', '560001', '08067739333', '560037002', '55XX1XXX19', '98561XXX1X9']