# Help with regexp

**URL:** <https://community.mp3tag.de/t/help-with-regexp/14630>\
**Category:** Off-Topic\
**Created:** [April 13, 2013, 12:08am UTC](https://community.mp3tag.de/t/help-with-regexp/14630 "2013-04-13T00:08:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daktari](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/6bbea6/32.png) [@daktari](https://community.mp3tag.de/u/daktari)\
**Post date:** [April 13, 2013, 12:08am UTC](https://community.mp3tag.de/t/help-with-regexp/14630/1 "2013-04-13T00:08:45Z")

</div>

This isn't exactly related to mp3tag, but I recalled this forum had some regexp experts, so I returned to see if I could get some assistance.

The scenario is this: movies I've ripped from BluRay over the years and then loaded onto my NAS have different naming conventions.

When I initially started ripping my collection, I chose **title.year.bluray.720p.dts.x264.mkv**. I later switched the source and resolution.

What regexp commands can I run to a) find the offending filenames, and b ) possibly change them for me? I can connect to the NAS with Putty and run commands via command line. Even if I only find them, that would be a big help. I can rename manually if necessary.

The files should be:

title.year.720p.bluray.dts.x264.mkv

NOT

title.year.bluray.720p.dts.x264.mkv

Much thanks if this can be done.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 13, 2013, 1:53pm UTC](https://community.mp3tag.de/t/help-with-regexp/14630/2 "2013-04-13T13:53:15Z")

</div>

> [@daktari](#):
>
> ... I can connect to the NAS with Putty and run commands via command line. Even if I only find them, that would be a big help. I can rename manually if necessary.
> 
> The files should be:
> 
> title.year.720p.bluray.dts.x264.mkv
> 
> NOT
> 
> title.year.bluray.720p.dts.x264.mkv
> 
> Much thanks if this can be done.

I am not sure if this is a regular expression thing.  
What I would do:  
Create a text file that has all the filenames, perhaps in a Command Shell with  
dir /s \>my.txt  
then I would load the text file into a word processor and replace all "." with ""  
(in Word this is ^t).  
Then create a table and sort it alphabetically.  
All the filenames that match one or the other pattern should be grouped together.  
Delete all entries for the correct names.

Now: copy all columns and insert them to right of the table.  
(you now have twice the same sequence in the each line).  
Select the column with the information that should get a new position in the filename and move it.  
Convert the table back again to text and if you can set it use the dot as separator otherwise ue the tab-stop.  
Then replace all tab-stops with a dot.  
then replace mkv. with mkv  
Then replace all paragraph-end characters (this is ^p in Word) with "^pren " (for "rename") and add a "ren " in the first line and delete one in the last.  
Now save the whole file plain text and the extension .bat and run it in a Command Shell so that you start a renaming job.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 13, 2013, 2:40pm UTC](https://community.mp3tag.de/t/help-with-regexp/14630/3 "2013-04-13T14:40:18Z")

</div>

Sorry, I am talking complete bull here.

Add the mkv files to the files that Mp3tag reads. (File\>Options\>Tags\>Restrict incoming files to)

Then set a filter to  
%\_filename% HAS "bluray.720p."

The use the converter Filename-Filename  
Enter as Source Pattern  
%1.%2.%3.%4.%5.%6

Enter as Target pattern:  
%1.%2.%4.%3.%5.%6

The preview should help you.

> -----snip-----\<  
> On November, 13th 2013 this topic has been on display for more than 7 months without any response by the OP. Is there a reward for longest period without an answer?  
> And: there was no more recent off-topic ...
