C
Chris Hoeppner
Hey!
I'm writing a little script to rename files with weird names but common
bits to a common format. Here's the regular expression I use to extract
the common data:
/.*s?(\d?\d)x?e?(\d\d).*\.(\w{3})$/i
It's meant to rename TV Show files, both video and subtitles. I'm having
trouble making it match the first group however. One of the digits
should be optional, so I stuffed a ? sign there. However, it only
matches one digit, leaving strings like 12x14 with captures ["2", "14"].
I'm not quite sure if there's anything wrong with my expression there,
but I'd swear it's the way to do it. Maybe you're able to see something
I'm looking past.
Thanks!
I'm writing a little script to rename files with weird names but common
bits to a common format. Here's the regular expression I use to extract
the common data:
/.*s?(\d?\d)x?e?(\d\d).*\.(\w{3})$/i
It's meant to rename TV Show files, both video and subtitles. I'm having
trouble making it match the first group however. One of the digits
should be optional, so I stuffed a ? sign there. However, it only
matches one digit, leaving strings like 12x14 with captures ["2", "14"].
I'm not quite sure if there's anything wrong with my expression there,
but I'd swear it's the way to do it. Maybe you're able to see something
I'm looking past.
Thanks!