Skip to content

Instantly share code, notes, and snippets.

@dardanxhymshiti
Last active July 3, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardanxhymshiti/c6f4e5e63d24f5b5d4a84e2e703d0845 to your computer and use it in GitHub Desktop.
Save dardanxhymshiti/c6f4e5e63d24f5b5d4a84e2e703d0845 to your computer and use it in GitHub Desktop.
def get_capital_words(text):
import re
pattern = r'(\b[A-Z]{2,}\b)'
list_of_capital_words = re.findall(pattern, text)
return list_of_capital_words;
# Test
text = """Thank you! Your customer service request has been logged. A specialist will reach out by EOD"""
get_capital_words(text)
# ['EOD']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment