import java.util.regex.Matcher;
import java.util.regex.Pattern;
class Ideone
{
public static void main
(String[] args
) { String haystack
[] = {"Ahmet Yıldırım",
"Esin AYDEMİR"}; String needle
[] = {"yildirim",
"aydemir"}; for (int i = 0; i < haystack.length; i++) {
System.
out.
println(find
(haystack
[i
], needle
[i
])); }
}
public static boolean find
(String haystack,
String needle
) { Pattern p = Pattern.compile(needle, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
Matcher m = p.matcher(haystack);
if (m.find()) {
System.
out.
println(m.
group()); return true;
} else {
return false;
}
}
}
aW1wb3J0IGphdmEudXRpbC5yZWdleC5NYXRjaGVyOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4LlBhdHRlcm47CgpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCVN0cmluZyBoYXlzdGFja1tdID0geyJBaG1ldCBZxLFsZMSxcsSxbSIsICJFc2luIEFZREVNxLBSIn07CgkJU3RyaW5nIG5lZWRsZVtdID0geyJ5aWxkaXJpbSIsICJheWRlbWlyIn07CgkJZm9yIChpbnQgaSA9IDA7IGkgPCBoYXlzdGFjay5sZW5ndGg7IGkrKykgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4oZmluZChoYXlzdGFja1tpXSwgbmVlZGxlW2ldKSk7CgkJfQoJCgl9CgkKCXB1YmxpYyBzdGF0aWMgYm9vbGVhbiBmaW5kKFN0cmluZyBoYXlzdGFjaywgU3RyaW5nIG5lZWRsZSkgewoJCVBhdHRlcm4gcCA9IFBhdHRlcm4uY29tcGlsZShuZWVkbGUsIFBhdHRlcm4uTElURVJBTCB8IFBhdHRlcm4uQ0FTRV9JTlNFTlNJVElWRSB8IFBhdHRlcm4uVU5JQ09ERV9DQVNFKTsKCQlNYXRjaGVyIG0gPSBwLm1hdGNoZXIoaGF5c3RhY2spOwoJCWlmIChtLmZpbmQoKSkgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4obS5ncm91cCgpKTsKCQkJcmV0dXJuIHRydWU7CgkJfSBlbHNlIHsKCQkJcmV0dXJuIGZhbHNlOwoJCX0KCQkKCX0KfQo=