Hello Programmers, In this post, you will know how to solve the HackerRank Matching Start & End Solution. This problem is a part of the Regex HackerRank Series.
One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.
HackerRank Matching Start & End Solutions
^
The ^ symbol matches the position at the start of a string.
$
The $ symbol matches the position at the end of a string.
Task
You have a test string S. Your task is to match the pattern Xxxxx.
Here, x denotes a word character, and X denotes a digit.
S must start with a digit X and end with .
symbol.
S should be 6 characters long only.
Note
This is a regex only challenge. You are not required to write code.
You have to fill the regex pattern in the blank (_________
).
HackerRank Matching Start & End Solutions in Cpp
HackerRank Matching Start & End Solutions in Java
public class Solution { public static void main(String[] args) { Regex_Test tester = new Regex_Test(); tester.checker("^\\d\\w{4}\\.$"); // Use \\ instead of using \ } }
HackerRank Matching Start & End Solutions in Python
Regex_Pattern = r"^\d\w{4}\.$" # Do not delete 'r'.
HackerRank Matching Start & End Solutions in JavaScript
var Regex_Pattern = /^[0-9][0-9a-zA-Z]{4}.$/; //Do not delete '/'. Replace __________ with your regex.
HackerRank Matching Start & End Solutions in PHP
$Regex_Pattern = "/^[0-9][\w]{4}[.]$/"; //Do not delete '/'. Replace __________ with your regex.
Disclaimer: This problem (Matching Start & End) is generated by HackerRank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.