Alternative Matching – HackerRank Solution

In this post, we will solve Alternative Matching HackerRank Solution. This problem (Alternative Matching) is a part of HackerRank Regex series.

Solution – Alternative Matching – HackerRank Solution

Python

Regex_Pattern = r'^(Mr\.|Mrs\.|Ms\.|Dr\.|Er\.)([a-zA-Z]+)$' # Do not delete 'r'.


import re

print(str(bool(re.search(Regex_Pattern, input()))).lower())

Note: This problem (Alternative Matching) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *