mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* more general "Part n" pattern
This commit is contained in:
parent
7768d2e905
commit
d1f12dd628
@ -43,7 +43,7 @@ String.prototype.replaceTrailingBraces = function(replacement) {
|
|||||||
// use empty string as default replacement
|
// use empty string as default replacement
|
||||||
var r = replacement ? replacement : "";
|
var r = replacement ? replacement : "";
|
||||||
|
|
||||||
return this.replace(/\s*\(([^\)]*)\)$/, r);
|
return this.replace(/\s*[(]([^)]*)[)]$/, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -57,9 +57,8 @@ String.prototype.replacePart = function (replacement) {
|
|||||||
// use empty string as default replacement
|
// use empty string as default replacement
|
||||||
var r = replacement ? replacement : "";
|
var r = replacement ? replacement : "";
|
||||||
|
|
||||||
// handle '(n)' and ': Part n' syntax
|
// handle '(n)', '(Part n)' and ': Part n' like syntax
|
||||||
var pattern = [/\s*\((\w+)\)$/i, /\s*\W? Part (\w+)$/i];
|
var pattern = [/\s*[(](\w+)[)]$/i, /\W*Part (\w+)\W*$/i];
|
||||||
|
|
||||||
for (var i = 0; i < pattern.length; i++) {
|
for (var i = 0; i < pattern.length; i++) {
|
||||||
if (pattern[i].test(this)) {
|
if (pattern[i].test(this)) {
|
||||||
return this.replace(pattern[i], r);
|
return this.replace(pattern[i], r);
|
||||||
|
Loading…
Reference in New Issue
Block a user