Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 273 Bytes

remove-word-starting-with-a-specific-character.md

File metadata and controls

9 lines (6 loc) · 273 Bytes

Remove word starting with a specific character

Take out the word if it starts with a certain letter. It can be done with regex or without. I prefer the regex one:

import re
clean = re.sub(r'(\s)?@\w+', r'\1', '@myStupidFriend please remove the mention')