Stefan wrote:>>I did match the entire filename...
Yes, but that would match probably on one file name only. Since other file names have the problem on another position, you can't rename more than one file at once?
The pre- and post- searches take care of position... (.*) and ([^\[].*)... so these would match on:
aaa [[[bbb]]] ccc ddd eee fff.
or
aaa bbb ccc ddd eee [[[fff]]].
Granted, it would get confused on
aaa [[[bbb]]] ccc ddd [[[eee]]] fff.
Because it has two sets of ['s to match... but in the filenames I have, I don't expect this to happen too often.
>>>The problem is that "+" appears to not be matching "1 or more" \[.
You may know that + works on the last expression on the left.
So it may be that \[+ only sees the [ as expression and not the escaped pack \[
So I would try (\[)+
Not sure if this works as it depends of the used regex engine and implementation.
To the best of my knowledge, the backslash/escape should trump pretty much everything else in order of operations for a regex.
Adding an extra couple parenthesis didn't help.
>>Normally, I do my bulk renaming with Perl... but since these renames are occurring on W32, I wanted a batch file solution.
Then try the Win32 equivalent 'PowerShell'
Like with VBS i would loop over the file name one-by-one sign and compare the current sign with the last one stored in a temp var.
Also the regex engine is more powerful as you can search&replace parts of an file name, instead oh having to match the whole name.
Me think you can do that with BRC too by executing many times search&replace two signs by one of them.
Find: ((
Repl: (
Find: ))
Repl: )
I don't want to loop or use temp variables... that's why I'm Regexing.
![Wink ;-)](./images/smilies/icon_wink.gif)
If BRC can't handle this stuff, I guess I'll make a Perl one liner to do it.
BKNJ