Custom regular expression request (1 Viewer)

Chubler

Portal Member
July 14, 2009
46
25
Home Country
Australia Australia
This is the way I designed it, Part1 should always be CD1 (blank if no CD1), Part2 would be CD2 (again blank if no CD2) and Part3 (if you setup the 3rd one as part3) would be CD3, So:
Code:
foo - CD1.iso  => Part1 = 1
foo - Part02 Part03 => Part2 = 02  Part3 = 03
foo - 3.mkv => Part3 = 3

If you want it so part1 is always the first CD number supplied and part2 is the 2nd CD supplied then just change 0*1 to 0*[123] and 0*2 to 0*[23]
 

mfsav2

Portal Member
March 11, 2008
22
0
Wonderful!

thank you!

----------

On expression 3 it works fine but if I use it in the code:
System.ArgumentException occurred
Message=parsing "[noparse]^(?<movie>[^-]*?)(?:[- [])+(?:(?:CD|part|DVD)?(?<part1>0*[123])]?)?(?: *\[?(?:CD|part|DVD)?(?<part2>0*[23])]?)?(?: * \[?(?:CD|part|DVD)?(?:0*3)]?)?\.(?<ext>[^.]*)$[/noparse]" - Quantifier {x,y} following nothing.
Source=System
StackTrace:
at System.Text.RegularExpressions.RegexParser.ScanRegex()
at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options)
InnerException:


What it could be ?

Found:
Option IgnoreWhitespaces
generates the error :(
 

mfsav2

Portal Member
March 11, 2008
22
0
One additional help, now that it works :)

I'm able to capture the data correctly with
[noparse]
^(?<movie>[^-]*?)(?:[- [])+(?:(?:CD|part|DVD)?(?<part1>0*[123])]?)?(?: *\[?(?:CD|part|DVD)?(?<part2>0*[23])]?)?(?: * \[?(?:CD|part|DVD)?(?<part2>0*3)]?)?\.(?<ext>[^.]*)$
[/noparse]


Issues:

1)
I have a false positive on
foo 2.avi
This should not be detected as
movie: foo
part1: 2

2)
a movie like
foo CD1 CD2 CD3 CD4.avi
is not detected.

Can we make the part2 that will take all repeated matching independently of the number of repetitions?

I tried to do it but failed :(

3)
I was raised an issue on titles (quite common) like:
The Lord of the Rings- The Fellowship of the Ring (2001) CD1.iso

It is not detected due to the -

Thank you
 

bugmenot

Portal Pro
January 13, 2007
130
2
hi. i don't get an reg.expression for the following case working:
Series: 24 ("Tag" means "day")

Folder structure: root\24\Season 1\
Filename(s):
S01E01 - Tag.1.-.00.00-01.00.avi
S01E02 - Tag.1.-.01.00-02.00.avi


can someone help me?

thx!
 

mfsav2

Portal Member
March 11, 2008
22
0
you should add a title before:

24 S01E01 - Tag.1.-.00.00-01.00.avi
24 S01E02 - Tag.1.-.01.00-02.00.avi

In this way it will detect the title 24 and the S and E

M
 

Chubler

Portal Member
July 14, 2009
46
25
Home Country
Australia Australia
One additional help, now that it works :)

I'm able to capture the data correctly with
[noparse]
^(?<movie>[^-]*?)(?:[- [])+(?:(?:CD|part|DVD)?(?<part1>0*[123])]?)?(?: *\[?(?:CD|part|DVD)?(?<part2>0*[23])]?)?(?: * \[?(?:CD|part|DVD)?(?<part2>0*3)]?)?\.(?<ext>[^.]*)$
[/noparse]


Issues:

1)
I have a false positive on
foo 2.avi
This should not be detected as
movie: foo
part1: 2

2)
a movie like
foo CD1 CD2 CD3 CD4.avi
is not detected.

Can we make the part2 that will take all repeated matching independently of the number of repetitions?

I tried to do it but failed :(

3)
I was raised an issue on titles (quite common) like:
The Lord of the Rings- The Fellowship of the Ring (2001) CD1.iso

It is not detected due to the -

Thank you

1) Can fix this by making a - or part,CD, DVD required, it will then support:
foo - 2.iso
foo part2.mkv
Lord of the rings - fellowship (2001) CD1.iso​
but not:
foo 2.iso
foo 1 2 3.iso
Lord of the rings - fellowship (2001) 1.iso​

2) Yes, would anything for 01 - 09 be enough? Note this may allow repeats or out of order items eg this is OK:
foo CD1 CD5 CD2 CD3 CD5 CD2.iso​
Also is there any need to have part1 and part2, why not put everything into parts as it makes the RE simpler?

3) Fix for 1 should address this



Updated RE for what I've discussed is:

[noparse]^(?<movie>.*?)(?: *(?:-|CD|part|DVD|disc|disk) *(?<parts>0*[1-9]))+\.(?<ext>[^.]*)$[/noparse]
 

Chubler

Portal Member
July 14, 2009
46
25
Home Country
Australia Australia
hi. i don't get an reg.expression for the following case working:
Series: 24 ("Tag" means "day")

Folder structure: root\24\Season 1\
Filename(s):
S01E01 - Tag.1.-.00.00-01.00.avi
S01E02 - Tag.1.-.01.00-02.00.avi


can someone help me?

thx!

My Post (#21) in the Expressions/Rules exchange thread has been updated to support this layout so you won't need to rename all your files if you put this RE in (probably best at position 2).
 

mfsav2

Portal Member
March 11, 2008
22
0
One additional help, now that it works :)

I'm able to capture the data correctly with
[noparse]
^(?<movie>[^-]*?)(?:[- [])+(?:(?:CD|part|DVD)?(?<part1>0*[123])]?)?(?: *\[?(?:CD|part|DVD)?(?<part2>0*[23])]?)?(?: * \[?(?:CD|part|DVD)?(?<part2>0*3)]?)?\.(?<ext>[^.]*)$
[/noparse]


Issues:

1)
I have a false positive on
foo 2.avi
This should not be detected as
movie: foo
part1: 2

2)
a movie like
foo CD1 CD2 CD3 CD4.avi
is not detected.

Can we make the part2 that will take all repeated matching independently of the number of repetitions?

I tried to do it but failed :(

3)
I was raised an issue on titles (quite common) like:
The Lord of the Rings- The Fellowship of the Ring (2001) CD1.iso

It is not detected due to the -

Thank you

1) Can fix this by making a - or part,CD, DVD required, it will then support:
foo - 2.iso
foo part2.mkv
Lord of the rings - fellowship (2001) CD1.iso​
but not:
foo 2.iso
foo 1 2 3.iso
Lord of the rings - fellowship (2001) 1.iso​

2) Yes, would anything for 01 - 09 be enough? Note this may allow repeats or out of order items eg this is OK:
foo CD1 CD5 CD2 CD3 CD5 CD2.iso​
Also is there any need to have part1 and part2, why not put everything into parts as it makes the RE simpler?

3) Fix for 1 should address this



Updated RE for what I've discussed is:

[noparse]^(?<movie>.*?)(?: *(?:-|CD|part|DVD|disc|disk) *(?<parts>0*[1-9]))+\.(?<ext>[^.]*)$[/noparse]


Why if I copy from the forum and post it in Expresso 3 it does not work? (does not match anything)
What am I doing wrong?
I feel very very stupid!
 

Chubler

Portal Member
July 14, 2009
46
25
Home Country
Australia Australia
Couple of possibilities:

You have extra carriage return characters at the end of the RE (look for ☐☐☐☐ following the $ in the Regex Analyser window. Solution is to put cursor just past the $ at the end and press delete until all the ☐ chars have gone.

You have “Ignore White” checked in the Design mode tab – uncheck this.

Attached my project file for you
 

Attachments

  • mfsav2.zip
    847 bytes

Users who are viewing this thread

Top Bottom