fork download
  1. import re
  2.  
  3. items = ['There is some random information here',
  4. 'This includes item p23344dd5 as well as other info',
  5. 'K3455 $100.00',
  6. 'Line4: ''Last part number here 5551234']
  7.  
  8. for item in items:
  9. x = re.search(r'(?<!\S)(?=\w{5})\w*\d\w*(?!\S)', item)
  10. if x:
  11. print(x.group())
Success #stdin #stdout 0.02s 9720KB
stdin
Standard input is empty
stdout
p23344dd5
K3455
5551234