By default (as in example X+) Java regex quantifiers are greedy , the regex engine starts out by matching as many characters it can. We can change this default behavior by appending another metacharacter e.g. X+?.
Read moreWhat is Java case-insensitive?
Java is a case-sensitive language, which means that the upper or lower case of letters in your Java programs matter .
Read moreHow do I check if a case is insensitive in regex?
If you want only part of the regex to be case insensitive (as my original answer presumed), then you have two options:
Read moreHow do you make a insensitive pattern case in Java?
In Java, by default, the regular expression (regex) matching is case sensitive. To enable the regex case insensitive matching, add (?) prefix or enable the case insensitive flag directly in the Pattern. compile() .7 Eyl 2013
Read moreIs Java regex case-insensitive?
Java Regular Expressions are case-sensitive by default .9 Mar 2021
Read moreHow do you write a case-insensitive in regex?
If you want only part of the regex to be case insensitive (as my original answer presumed), then you have two options:
Read more