In this post, we will solve Matching Specific Characters HackerRank Solution. This problem (Matching Specific Characters) is a part of HackerRank Regex series.
The character class
[ ] matches only one out of several characters placed inside the square brackets.
You have a test string S.
Your task is to write a regex that will match S with following conditions:
- S must be of length:
- First character:
- Second character:
- Third character:
- Fourth character:
- Fifth character:
- Sixth character:
This is a regex only challenge. You are not required to write any code.
You have to fill the regex pattern in the blank (
Solution – Matching Specific Characters – HackerRank Solution
Regex_Pattern = r'^[xs0][30Aa][xsu][.,]$' # Do not delete 'r'. import re print(str(bool(re.search(Regex_Pattern, input()))).lower())
Note: This problem (Matching Specific Characters) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.