Task
You have a test string S. Your task is to match the string hackerrank. This is case sensitive.
Note
This is a regex only challenge. You are not required to write code.
You only have to fill in the regex pattern in the blank (_________).
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Regex_Test tester = new Regex_Test();
tester.checker("hackerrank");
} }
class Regex_Test {
public void checker(String Regex_Pattern){
Scanner Input = new Scanner(System.in);
String Test_String = Input.nextLine();
Pattern p = Pattern.compile(Regex_Pattern);
Matcher m = p.matcher(Test_String);
int Count = 0;
while(m.find()){
Count += 1;
}
System.out.format("Number of matches : %d",Count);
}
}