I am trying to write a regex matcher, where by the string should start with 'Feb' , have a space, and then followed by 2 digits.
String x = "Feb 04 |";
String regex = "^Feb d{2}";
Pattern p = Pattern.compile(regex);
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(x);
while (matcher.find())
{
System.out.print("FOUND");
}
'String regex = "^Feb";' does well to detect if it starts with Feb, but trying to detect there is a space followed by 2 digits.
dwill just match the letterd- check the documentation Pattern\dis a digit (and in Java strings you need an additional \ to escape the first one:"^Feb \\d{2}")