Swap text within [Brackets]

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Swap text within [Brackets]

Postby Randy » Tue May 18, 2010 11:06 pm

New to the forum and but I don't get the RegEx in order to accomplish this rename of files
09 MSOW SystemConfigRequirements[MOR000326-329].pdf
to
[MOR000326-329] 09 MSOW SystemConfigRequirements.pdf

Please enlighten me.
Randy
 
Posts: 2
Joined: Tue May 18, 2010 10:53 pm

Re: Swap text within [Brackets]

Postby Stefan » Wed May 19, 2010 7:18 am

Hi Randy, welcome.

Randy wrote:New to the forum and but I don't get the RegEx in order to accomplish this rename of files
09 MSOW SystemConfigRequirements[MOR000326-329].pdf
to
[MOR000326-329] 09 MSOW SystemConfigRequirements.pdf

Please enlighten me.


Test this with some test files:

FROM:
09 MSOW SystemConfigRequirements[MOR000326-329].pdf
TO:
[MOR000326-329] 09 MSOW SystemConfigRequirements.pdf

Search for "all signs" and group them for reuse, ==> "(.+)" == This first group can be accessed in the ouput put by "\1"
till an "[" and then for "all signs" till an "]" and group them too ==> "([.+])" == This second group can be accessed in the ouput put by "\2"

But since "[" and "]" are regex meta-chars we have to escape them by an "\" ===> "\[" and "\]" ===> "(\[.+\])"

Then reorder this two groups in the output and put an space in between ===> "\2~\1"

DO:
RegEx(1)
Search: (.+)(\[.+\])
Replac: \2 \1


HTH? :D
If yes: please help two others too.

Note:
If i had used "quotes", then don't use them for real, they are only for explanation.
If i had used ~ signs exchange them each by an space/blank.

See this older threads for an RegEx syntax overview:
=> Getting Started: http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=5
=> Go ahead: http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=27
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Swap text within [Brackets]

Postby Randy » Thu May 20, 2010 12:26 am

Thanks so much you are truly a blessing. The program is excellent. With your example a small light has come on.
Randy
 
Posts: 2
Joined: Tue May 18, 2010 10:53 pm


Return to BRU Support