I am trying to implement custom regular expressions in my Java program to verify if my input string matches the regex. But for some reason, the regex fails at a particular point