In this post, we will solve Matching Ending Items HackerRank Solution. This problem (Matching Ending Items) is a part of HackerRank Regex series.
The $ boundary matcher matches an occurrence of a character/character class/group at the end of a line.
Write a RegEx to match a test string, S, under the following conditions:
- S should consist of only lowercase and uppercase letters (no numbers or symbols).
- S should end in
This is a RegEx-only challenge, so you are not required to write any code.
Simply replace the blank (
_________) with your RegEx pattern.
Solution – Matching Ending Items – HackerRank Solution
Regex_Pattern = r'^[a-zA-Z]*s$' # Do not delete 'r'. import re print(str(bool(re.search(Regex_Pattern, input()))).lower())