Skip to content

Instantly share code, notes, and snippets.

@cenkc
Last active October 21, 2019 11:37
Show Gist options
  • Save cenkc/f1d4f26d9ab068375d0c3e8324b3643f to your computer and use it in GitHub Desktop.
Save cenkc/f1d4f26d9ab068375d0c3e8324b3643f to your computer and use it in GitHub Desktop.
regex case-insensitive search
public static void main(String[] args) {
// regex case-insensitive search (?i:SOME_STRING)
String hede = "http://127.0.0.1:8888/SomeWS/SomeWSEndpointService?wSdL";
String hodo = hede.replaceFirst("(?i:\\?wsdl)", "?wsdl");
System.out.println("hede = " + hede);
System.out.println("hodo = " + hodo);
}
//hede = http://127.0.0.1:8888/SomeWS/SomeWSEndpointService?wSdL
//hodo = http://127.0.0.1:8888/SomeWS/SomeWSEndpointService?wsdl
// Credit:
// https://alvinalexander.com/blog/post/java/java-how-case-insensitive-search-string-matches-method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment