fork download
  1. import re
  2. docs = ['Hi, my name is Eric. Are you blue?',
  3. "Hi, I'm ! What is your name?",
  4. 'This is a great idea. I would love to go.',
  5. 'Hello, I am Jane Brown. What is your name?',
  6. "Hello, I am a doctor! Let's go to the mall.",
  7. 'I am ready to go. Mom says hello.']
  8. docs = [re.sub(r'^H(?:ello|i)\b.*?[.?!]\s+', '', doc) for doc in docs]
  9. print(docs)
Success #stdin #stdout 0.03s 9560KB
stdin
Standard input is empty
stdout
['Are you blue?', 'What is your name?', 'This is a great idea. I would love to go.', 'What is your name?', "Let's go to the mall.", 'I am ready to go. Mom says hello.']