In this post, we will solve Matching Digits & Non-Digit Characters HackerRank Solution. This problem (Matching Digits & Non-Digit Characters) is a part of HackerRank Regex series.
The expression \d matches any digit [0 – 9].
The expression \D matches any character that is not a digit.
You have a test string S. Your task is to match the pattern xxXxxXxxxx
Here x denotes a digit character, and X denotes a non-digit character.
This is a regex only challenge. You are not required to write any code.
You only have to fill the regex pattern in the blank (
Solution – Matching Digits & Non-Digit Characters – HackerRank Solution
Regex_Pattern = r"\d\d(.)\d\d(.)\d\d\d\d" # Do not delete 'r'. import re print(str(bool(re.search(Regex_Pattern, input()))).lower())