Removing string from the middle of a filename

A swapping-ground for Regular Expression syntax

Removing string from the middle of a filename

Postby yabai » Sat Jun 21, 2014 11:51 am

So I have some files which go like this
01. blahblahString1 01. - yadayadaString2.mp3
02. xxxxxxxStringA 02. - yyyyStringB.mp3

(Note, there are two spaces after the second "0[1-9].")

I want to remove everything between the second set of digits (including it) and the second string, replacing it with '(' so it should end up like
01. blahblahString1 (yadayadaString2.mp3
02. xxxxxxxStringA (yyyyStringB.mp3
After which, I would then just add a ')' as a suffix which should give me
01. blahblahString1 (yadayadaString2).mp3
02. xxxxxxxStringA (yyyyStringB).mp3

Trouble is, I don't know anything about regexs (or BRU for that matter). I tried to use and make a regex myself but it didn't work (duh). I would appreciate some help in this. Thanks for reading.
This is what I came up with
Code: Select all
(.*)([0-9][0-9].  - )(.*)

And maybe this might not be needed, but the first set of string isn't in English, or Latin alphabets. It's in Japanese. The second string is in English.
Posts: 1
Joined: Sat Jun 21, 2014 11:35 am

BRUs regex isnt Unicode-compliant

Postby truth » Tue Jun 24, 2014 11:17 am

BRU's regex is not Unicode-compliant.
IF it were, the expression would be similiar to:

1Regex match/replace:
^(\d\d\. .+ )\d\d\. - (.+)
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Return to Regular Expressions