<jupyter_start><jupyter_text>Regular Expressions<jupyter_code>import re<jupyter_output><empty_output><jupyter_text>example data<jupyter_code>line = '{"usernameTweet": "Tom", "ID": "1176953905143590912", "text": "Cant agree more! RT:Masks + vaccines + boosters = best protection against #Omicron.When you wear a mask, you help protect yourself & others from #COVID19. Choose a mask with the best fit, protection, and comfort for you.", "url": "/CDCGOV/status/1176953905143590912", "nbr_retweet": 26740, "nbr_favorite": 105089, "nbr_reply": 17181, "datetime": "2022-01-14 16:17:32", "is_reply": false, "is_retweet": true, "retweet_user_id": "16460678", "retweet_username": "CDCGOV"}'
try:
    result = re.search(r'"usernameTweet": "(.*?)", ', line)
except:
    result = None
    
try:
    result2 = re.search(r'retweet_username": "(.*?)"}', line)
except:
    result2 = None

result_list = list([result.group(1),result2.group(1)])
print(result_list)<jupyter_output>['Tom', 'CDCGOV']
{'fraction_non_alphanumeric': 0.16853932584269662, 'fraction_numerical': 0.08478038815117467, 'mean_word_length': 6.65625, 'pattern_counts': {'":': 14, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '667162', 'license': 'Apache-2.0', 'n_tokens_mistral': 414, 'n_tokens_neox': 359, 'n_words': 79, 'path': 'scripts/Regular Expressions (Toy Data).ipynb', 'repo_name': 'masiyua1/Python_tutorial', 'size': '979'}