mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-10 06:20:27 -04:00
Fix upperInitial/lowerTrail behavior when there are apostrophes (e.g. He'll)
@see https://www.filebot.net/forums/viewtopic.php?f=5&t=4500
This commit is contained in:
parent
6342efc743
commit
e7a4140426
@ -192,12 +192,13 @@ public class ExpressionFormatMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String replaceHeadTail(String self, Function<String, String> head, Function<String, String> tail) {
|
public static String replaceHeadTail(String self, Function<String, String> head, Function<String, String> tail) {
|
||||||
Matcher matcher = compile("\\b(\\p{Alnum})(\\p{Alnum}*)\\b", UNICODE_CHARACTER_CLASS).matcher(self);
|
Matcher matcher = compile("\\b(['`´]|\\p{Alnum})(\\p{Alnum}*)\\b", UNICODE_CHARACTER_CLASS).matcher(self);
|
||||||
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
matcher.appendReplacement(buffer, head.apply(matcher.group(1)) + tail.apply(matcher.group(2)));
|
matcher.appendReplacement(buffer, head.apply(matcher.group(1)) + tail.apply(matcher.group(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return matcher.appendTail(buffer).toString();
|
return matcher.appendTail(buffer).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user