You can also match case insensitive regexs and make it more readable by using the Pattern.CASE_INSENSITIVE constant like:

Pattern mypattern = Pattern.compile(MYREGEX, Pattern.CASE_INSENSITIVE);
Matcher mymatcher= mypattern.matcher(mystring);
Answer from Christian Vielma on Stack Overflow
🌐
Baeldung
baeldung.com › home › java › java string › case-insensitive string matching in java
Case-Insensitive String Matching in Java | Baeldung
August 28, 2025 - We can also use String.regionMatches(). It checks if two String regions match, using true for the ignoreCase parameter: public static boolean processRegionMatches(String src, String dest) { for (int i = src.length() - dest.length(); i >= 0; i--) if (src.regionMatches(true, i, dest, 0, dest.length())) return true; return false; } ... To improve the performance, it starts matching the region, taking into account the length of the destination String. Then, it diminishes the iterator. The java.util.regex.Pattern class provides us a way of matching strings using the matcher() method.
Discussions

java - Match strings with regular expression in ignore case - Stack Overflow
Use the regex (?i)^(?!kb).* for case insensitive matches. It will avoid KB234 Kb*432, kB2343 and kb23445. ... Here is the code snippet that can help for the ignore case understanding with String.matches function, for further details please use this [link][1] More on stackoverflow.com
🌐 stackoverflow.com
regex to ignore case

You have to put the entirety of what you want matched inside a set of parenthesis. In your case, it would look like the following: ((?i)user.name)

Let me know if that helped.

More on reddit.com
🌐 r/QRadar
5
1
February 17, 2017
regex - Java - Ignore case checking user input - Stack Overflow
I need to check if the user input matches anything in a Set or List, but I am currently using .contains(). Obviously this is not working when the user inputs something that is not the correct case... More on stackoverflow.com
🌐 stackoverflow.com
java - ignore case regex - Stack Overflow
How do I ignore case for my match? More on stackoverflow.com
🌐 stackoverflow.com
🌐
Rip Tutorial
riptutorial.com › ignore case modifier
Regular Expressions Tutorial => IGNORE CASE modifier
Unicode-aware case-insensitive matching can be enabled by specifying the UNICODE_CASE flag in conjunction with this (CASE_INSENSITIVE) flag. (e.g. Pattern p = Pattern.compile("YOUR_REGEX", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);).
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-make-java-regular-expression-case-insensitive-in-java
How to Make Java Regular Expression Case Insensitive in Java? - GeeksforGeeks
March 9, 2021 - So to make the Java Regular Expression case-insensitive we pass the pattern along with the " ?i " modifier that makes it case-insensitive.
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › regex › pattern.html
Methods of the Pattern Class (The Java™ Tutorials > Essential Java Classes > Regular Expressions)
Unicode-aware case folding can also be enabled via the embedded flag expression (?u). Specifying this flag may impose a performance penalty. Pattern.UNIX_LINES Enables UNIX lines mode. In this mode, only the '\n' line terminator is recognized in the behavior of ., ^, and $. UNIX lines mode can also be enabled via the embedded flag expression (?d). In the following steps we will modify the test harness, RegexTestHarness.java to create a pattern with case-insensitive matching.
Find elsewhere
🌐
Alvin Alexander
alvinalexander.com › blog › post › java › java-how-case-insensitive-search-string-matches-method
Java: How to perform a case-insensitive search using the String ‘matches’ method | alvinalexander.com
September 30, 2019 - Here's the source code for a complete Java program that demonstrates this case-insensitive pattern matching technique: /** * Demonstrates how to perform a case-insensitive pattern * match using String and the String.matches() method. */ public class StringMatchesCaseInsensitive { public static void main(String[] args) { String stringToSearch = "Four score and seven years ago our fathers ..."; // this won't work because the pattern is in upper-case System.out.println("Try 1: " + stringToSearch.matches(".*SEVEN.*")); // the magic (?i:X) syntax makes this search case-insensitive, so it returns true System.out.println("Try 2: " + stringToSearch.matches("(?i:.*SEVEN.*)")); } }
🌐
Mkyong
mkyong.com › home › regular expressions › regular expression case sensitive example – java
Regular Expression case sensitive example - Java - Mkyong.com
September 7, 2013 - Example to use regex case insensitive matching to get the “Registrar” information. package com.mkyong.regex import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RunExampleTest{ private Pattern registrarPattern = Pattern.compile(REGISTRAR_PATTERN); //alternative /*private Pattern registrarPattern = Pattern.compile(REGISTRAR_PATTERN, Pattern.CASE_INSENSITIVE);*/ private Matcher matcher; private static final String REGISTRAR_PATTERN = "(?)Registrar:\\s(.*)"; public static void main(String[] args) { String data = "Testing...
🌐
Kodejava
kodejava.org › how-do-i-match-a-regex-pattern-in-case-insensitive
How do I match a regex pattern in case-insensitive? - Learn Java by Examples
May 30, 2023 - Finding the next subsequence of ... regular expression can simply apply by create a pattern using compile(String regex, int flags) method and specifies a second argument with PATTERN.CASE_INSENSITIVE constant. package ...
🌐
Educative
educative.io › answers › what-is-patterncaseinsensitive-in-java
What is Pattern.CASE_INSENSITIVE in Java?
The CASE_INSENSITIVE field of the Pattern class is used for pattern matching without case considerations. Characters from the US-ASCII charset are matched by default · For unicode case-insensitive matching, combine the UNICODE_CASE flag with ...
🌐
DeepSource
deepsource.com › directory › java › issues › JAVA-E1010
Case insensitive regex does not properly handle Unicode input (JAVA-E1010) ・ Java
Java provides the Pattern.CASE_INSENSITIVE flag, as well as the (?i) regex group construct to enable case insensitive mode in regular expressions.
🌐
YouTube
youtube.com › codezone
java regex ignore case - YouTube
Get Free GPT4o from https://codegive.com ### java regex: ignore casejava provides a powerful regex (regular expression) api that allows developers to perfor...
Published: October 29, 2024
Views: 2
🌐
Bennadel
bennadel.com › blog › 301-case-insensitive-java-regular-expressions-how-did-i-miss-that.htm
Case Insensitive Java Regular Expressions - How Did I Miss That!?!
March 22, 2020 - As I describe above, the regular expression methods used on the Java string class: String::Matches() String::ReplaceFirst() String::ReplaceAll() ... allow for much more powerful AND faster regular expressions. Those methods can handle all the look behinds (negative and possitive) which I don't think ColdFusion can handle at all. That means that they can do much more than things like: ... So, it's speed, but it's also flexability. ... If (?i) and (?i:regex) works, (?-i) might also work, which with some regex libraries turns off case insensitivity for the remainder of the regular expression, e.g.: (?i)libby(?-i)[a-z]
🌐
Qvera
qvera.com › kb › index.php › 2072 › how-can-do-case-insensitive-search-with-regular-expression
How can I do a case insensitive search with a regular expression? - Knowledge Base - Qvera
October 16, 2018 - I have a regular expression like "PID5.1=regex:/.*John.*/" however it does not find message ... Is there a way to make it case insensitive?