Matching Ending Items – HackerRank Solution

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 s.

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(, input()))).lower())

Note: This tutorial (Matching Ending Items) 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 *