How would I go about executing a block of code if the pattern matches or execute another block of code if the pattern does not match?
String input = "abc";
final String mainRegex = "(.*?)(&!|&|==)";
final Matcher matcher = Pattern.compile(mainRegex).matcher(input);
I have tried
if(matcher1.matches())
{
execute this block
}
else
{
execute this block
}
But it always executes the else block. Even when the input is a>b&!c<d.