Reputation: 1994
How do I ignore case for my match? I am trying to match:
public static void main(String[] args) {
Pattern pattern = Pattern.compile("(?i)^concat\\(",Pattern.MULTILINE);
Matcher matcher = pattern.matcher("CONCAT(trade,ca)");
System.out.println(matcher.find());
}
Possible scenarios
CONCAT( = true
concat( = true
CONCAT(test = true
concat(test = true
concat = false
CONCAT = false
TESTCONCAT( = false
Upvotes: 0
Views: 99
Reputation: 1343
Pattern
has the flag CASE_INSENSITIVE
so all you need is
Pattern pattern = Pattern.compile("^concat\\(",Pattern.MULTILINE+Pattern.CASE_INSENSITIVE);
Upvotes: 2