Regular Expression: move one character

A swapping-ground for Regular Expression syntax

Regular Expression: move one character

Postby Mark Hale » Mon Jun 20, 2016 4:45 am

Hello everyone,
Hours of research and I can't work out a solution and have hundreds of files to amend after having made an irreversible mistake with BRU.

Problem: I need to move the first character of the second group and make it the first character of the third group. eg. 09 YAl Stewart - ear Of The Cat to read 09 Al Stewart - Year Of The Cat

Thanks in advance anyone

Mark
Mark Hale
 
Posts: 6
Joined: Wed Nov 04, 2015 12:35 am

Re: Regular Expression: move one character

Postby therube » Mon Jun 20, 2016 11:31 am

Code: Select all
Match:  (.*?) (.)(.* - )(.*)
Replace:  \1 \3\2\4
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Regular Expression: move one character

Postby Mark Hale » Fri Jun 24, 2016 11:53 pm

Thank you so much for that solution. Needless to say, it works perfectly.

I will analyse the solution and hopefully learn from it.

I really appreciate your prompt response.

Regards

Mark H.
Mark Hale
 
Posts: 6
Joined: Wed Nov 04, 2015 12:35 am


Return to Regular Expressions