Java case insensitive String replaceAll
Here’s a quick handy tip for replacing all occurrences of a substring regardless of case in Java. Put “(?i)” at the beginning of your substring. For example:
String a = "hello HELLO hEllO";
String b = a.replaceAll("(?i)hello", "bye");
System.out.println(a);
System.out.println(b);
The above code will output:
hello HELLO hEllO
bye bye bye
Short URL for this post: http://tmblr.co/Zd8FQxE1CQWr