1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 22:05:00 -05:00

Strip newline characters from format expression results

This commit is contained in:
Reinhard Pointner 2016-08-10 21:00:27 +08:00
parent 5818685e1f
commit 0ae7161b47
2 changed files with 4 additions and 1 deletions

View File

@ -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) {

View File

@ -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);
} }