There's a new manual at
http://www.bulkrenameutility.co.uk/foru ... =12&t=4743 & it covers regex too.
There's also a regex post at
http://www.bulkrenameutility.co.uk/foru ... p?f=3&t=96.
I think that post includes links to places for learning regex..
I'll cover this one the best I can. Consider it just a primer:
The regex match-box works by (Grouping) text that you wanna keep.
Anything that's been (Grouped) in the match-box can be represented by
\# in the replacement-box.
The 1st-set of parenthesis in the match-box is Group1, the 2nd-set is Group2, etc..
If theres some filename-text you
dont want, there's no need to (Group-it) within parenthesis.
The replacement-box is where you
can re-order groups, if desired like: \4\3\2\1 (to reverse the groups).
Its also where you include your additions to the groups like: \1\2_\3\4abc--\1\1xyz
Replacements are the easy part, but matching can be frustrating when starting out.
One of the tricky things to matching, is that regex has few special-chars like:
[](){}.?*^$.
If you have those in a filename, they must be matched with a leading backslash like:
\[ or
\] etc.
There's not alot them, so once you know what they are, you're good to go.
Character-sets are specified like: [A-Z] for 1-Uppercase-Letter, or like: [a-c] for a, b,
or c.
You can also spec them as: [A-Z]{2,4} for at least 2-Uppercases, but not more than four.
But almost everyone uses: [A-Z]+ for 1-or-more.. There's also [A-Z]* for 0-or-more.
. is a char-set all by itself, it means
any 1-character, so...
(.*)
XX matches everything until the
last-occurence of
XX.
(.*
?)
XX matches everything until the
1st-occurence of
XX.
So with your example:
^(.*)([A-Z]\. [A-Z]\.) ([A-Z].*?,)(.*)$
\1\3 \2\4
Group1: (.*)
Matches anything until the last-occurence of what follows in the match-box (Group2) etc.
Since * means 0-or-More, this group
can match nothing (desired in case name starts like: R. M.)
Group2: ([A-Z]\. [A-Z]\.)
Matches UpperCase. Uppercase.
Group3: ([A-Z]
.*?,)
Matches Uppercase
anything until the 1st-occurence of comma
Group4: (.*)
Matches anything until the end of filename..
Like Group1, it
can match nothing (in case Group3 already matched end of filename).
The leading ^ means to start matching at the 1st-character in filename, and $ means end-of-filename.
You dont always need them, but its a very good practice.. The replacement just re-orders the groups & adds a space.
Cheers.