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/7f64e68e9492861eebc15adc6a78c545 to your computer and use it in GitHub Desktop.
Save dardanxhymshiti/7f64e68e9492861eebc15adc6a78c545 to your computer and use it in GitHub Desktop.
def get_text_within_quotes(text):
import re
pattern = "\"(.*?)\""
list_of_findings = re.findall(pattern, text)
return list_of_findings
# Test
text = """The sign said, "Walk". Then it said, "Don't Walk" then, "Walk" all within thirty seconds"""
get_text_within_quotes(text)
# ['Walk', "Don't Walk", 'Walk']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment