replace between name

A swapping-ground for Regular Expression syntax

replace between name

Postby envio50 » Wed Jan 13, 2010 12:36 pm

Hello everybody,

I am a beginner in BRU, indeed I dont know a word about programming. So it should be very great if you can help me with this task.

I have some files with the same pattern:

project - 01 plan.dwg
project - 02 basement.dwg
project - 03 roof.dwg

I would like to insert a "-" next to the number:

project - 01 - plan.dwg
project - 02 - basement.dwg
project - 03 - roof.dwg

Could anyone tell me how to solve thisproblem?

Thank you everybody.
envio50
 
Posts: 2
Joined: Wed Jan 13, 2010 12:29 pm

Re: replace between name

Postby Stefan » Wed Jan 13, 2010 8:14 pm

envio50 wrote:Hello everybody,

I am a beginner in BRU, indeed I dont know a word about programming. So it should be very great if you can help me with this task.

I have some files with the same pattern:

project - 01 plan.dwg
project - 02 basement.dwg
project - 03 roof.dwg

I would like to insert a "-" next to the number:

project - 01 - plan.dwg
project - 02 - basement.dwg
project - 03 - roof.dwg

Could anyone tell me how to solve thisproblem?

Thank you everybody.

Hi envio, welcome.

FROM:
project - 01 plan.dwg
TO:
project - 01 - plan.dwg
DO:
RegEx greedy search for all signs till an digit ==> (.+\d) followed by an blank ==> \s, followed by the rest ==> (.+).
This (...) are capture groups to hold what is found by the RegEx.
Then replace by the contain of group 1 ==> \1, type dash and blank, put the containt of group 2 ==> \2


So try this:
RegEx(1)
Match: (.+\d\s)(.+)
Repla: \1- \2

Selections(12)
Filter: *.dwg

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




See this both oldest threads in the "Regular Expressions" forum 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: replace between name

Postby envio50 » Tue Jan 19, 2010 4:49 pm

Thanksss!!!
envio50
 
Posts: 2
Joined: Wed Jan 13, 2010 12:29 pm


Return to Regular Expressions


cron