fork download
  1. import re
  2. text = """John SMith: A
  3. Pedro Smith: B
  4. Jonathan B: A
  5. John B: B
  6. Luis Diaz: A
  7. Scarlet Diaz: B"""
  8. print( re.findall(r'\b([^:\n]*):\s*B', text) )
Success #stdin #stdout 0.02s 9616KB
stdin
Standard input is empty
stdout
['Pedro Smith', 'John B', 'Scarlet Diaz']