Last active
July 2, 2018 12:34
-
-
Save yoshiki-0428/d4485fcd5d7ba898f56b08a184e8ff9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String keyword = "java"; | |
String data = "Java java javaJava"; | |
// (?i)で大文字小文字区別しない | |
// ヒットした文字を()で区別化 | |
data = data.replaceAll("((?i)" + keyword + ")", "<mark>$1</mark>"); | |
// <mark>Java</mark> <mark>java</mark> <mark>java</mark><mark>Java</mark> | |
System.out.println(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment