Strip newline characters from format expression results
This commit is contained in:
parent
5818685e1f
commit
0ae7161b47
|
@ -3,6 +3,7 @@ package net.filebot.format;
|
||||||
import static net.filebot.similarity.Normalization.*;
|
import static net.filebot.similarity.Normalization.*;
|
||||||
import static net.filebot.util.ExceptionUtilities.*;
|
import static net.filebot.util.ExceptionUtilities.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
|
import static net.filebot.util.RegularExpressions.*;
|
||||||
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.text.FieldPosition;
|
import java.text.FieldPosition;
|
||||||
|
@ -212,7 +213,7 @@ public class ExpressionFormat extends Format {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String normalizeResult(CharSequence value) {
|
protected String normalizeResult(CharSequence value) {
|
||||||
return replaceSpace(value.toString(), " ").trim();
|
return replaceSpace(NEWLINE.matcher(value).replaceAll(""), " ").trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleException(ScriptException exception) {
|
protected void handleException(ScriptException exception) {
|
||||||
|
|
|
@ -18,4 +18,6 @@ public class RegularExpressions {
|
||||||
public static final Pattern SLASH = compile("\\s*[\\\\/]+\\s*", UNICODE_CHARACTER_CLASS);
|
public static final Pattern SLASH = compile("\\s*[\\\\/]+\\s*", UNICODE_CHARACTER_CLASS);
|
||||||
public static final Pattern SPACE = compile("\\s+", UNICODE_CHARACTER_CLASS); // French No-Break Space U+00A0
|
public static final Pattern SPACE = compile("\\s+", UNICODE_CHARACTER_CLASS); // French No-Break Space U+00A0
|
||||||
|
|
||||||
|
public static final Pattern NEWLINE = compile("\\R+", UNICODE_CHARACTER_CLASS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue