<jupyter_start><jupyter_text>Q1. Write a regular expression to match all the files that have either .exe, .xml or .jar extensions. A valid file name can contain any alphabet, digit and underscore followed by the extension.<jupyter_code>files = ['employees.xml', 'calculator.jar', 'nfsmw.exe', 'bkgrnd001.jpg', 'sales_report.ppt']

result = []

# write your code here

# print result - result should only contain the items that match the pattern. In this case, result should be ['employees.xml', 'calculator.jar', 'nfsmw.exe']
print(result)<jupyter_output><empty_output><jupyter_text>Q2. Write a regular expression to match all the addresses that have Koramangala embedded in them.Strings that should match:* 466, 5th block, Koramangala, Bangalore* 4th BLOCK, KORAMANGALA - 560034Strings that shouldn't match:* 999, St. Marks Road, Bangalore<jupyter_code>addresses = ['466, 5th block, Koramangala, Bangalore', '4th BLOCK, KORAMANGALA - 560034', '999, St. Marks Road, Bangalore']

result = []

# write your code here


# print result - result should only contain the items that match the pattern
print(result)<jupyter_output><empty_output><jupyter_text>Q3. Write a regular expression that matches either integer numbers or floats upto 2 decimal places.Strings that should match: * 2* 2.3* 4.56* .61Strings that shoudln't match:* 4.567* 75.8792* abc<jupyter_code>numbers = ['2', '2.3', '4.56', '.61', '4.567', '75.8792', 'abc']

result = []

# write your code here


# print result - result should only contain the items that match the pattern
print(result)<jupyter_output><empty_output><jupyter_text>Q4. Write a regular expression to match the model names of smartphones which follow the following pattern: mobile company name followed by underscore followed by model name followed by underscore followed by model numberStrings that should match:* apple_iphone_6* samsung_note_4* google_pixel_2Strings that shouldn’t match:* apple_6* iphone_6* google\_pixel\_<jupyter_code>phones = ['apple_iphone_6', 'samsung_note_4', 'google_pixel_2', 'apple_6', 'iphone_6', 'google_pixel_']

result = []

# write your code here


# print result - result should only contain the items that match the pattern
print(result)<jupyter_output><empty_output><jupyter_text>Q5.Write a regular expression that can be used to match the emails present in a database. The pattern of a valid email address is defined as follows:The '@' character can be preceded either by alphanumeric characters, period characters or underscore characters. The length of the part that precedes the '@' character should be between 4 to 20 characters.The '@' character should be followed by a domain name (e.g. gmail.com). The domain name has three parts - a prefix (e.g. 'gmail'), the period character and a suffix (e.g. 'com'). The prefix can have a length between 3 to 15 characters followed by a period character followed by either of these suffixes - 'com', 'in' or 'org'.Emails that should match:* <EMAIL>* <EMAIL>Emails that shouldn’t match:* <EMAIL>* @gmail.com* <EMAIL>* <EMAIL>* neeraj@<jupyter_code>emails = ['<EMAIL>', '<EMAIL>', '<EMAIL>',
          '@gmail.com','<EMAIL>', '<EMAIL>', 'neeraj@']

result = []

# write your code here


# print result - result should only contain the items that match the pattern
print(result)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10364567640855679, 'fraction_numerical': 0.02681530581500452, 'mean_word_length': 5.311787072243346, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '38829', 'license': 'Apache-2.0', 'n_tokens_mistral': 1067, 'n_tokens_neox': 989, 'n_words': 400, 'path': '05Natural Language Processing/01Lexical Processing/01Introduction to NLP/Bonus+exercise.ipynb', 'repo_name': 'talk2sunil83/UpgradLearning', 'size': '3407'}