diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index 61fd65f1..dfc6887e 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -146,6 +146,15 @@ public class ExpressionFormatMethods { return compile("\\s*[:]\\s*", UNICODE_CHARACTER_CLASS).matcher(self).replaceAll(replacement); } + /** + * Replace slash and backslash to make sure the result is not a file path. + * + * e.g. "V_MPEG4/ISO/AVC" -> "V_MPEG4.ISO.AVC" + */ + public static String slash(String self, String replacement) { + return compile("\\s*[\\\\/]+\\s*", UNICODE_CHARACTER_CLASS).matcher(self).replaceAll(replacement); + } + /** * Upper-case all initials. *