#1 : 10/02-16 23:37 Bernie2504
Posts: 17
|
Hi,
Thx for this powerful tool - i like it, but ... unfortunately, I have problems with the usage of regular expressions my "problem": i want to swap the last 2 words of filenames / folders with various length e.g.: hello my friend, how are you ! - Bugs Bunny.mpx should be hello my friend, how are you ! - Bunny Bugs.mpx or God does not play dice - 1926 Albert Einstein should be God does not play dice - 1926 Einstein Albert what's the correct phrase regards |
#2 : 11/02-16 10:37 Tester123
Posts: 92
|
Try this Replace method:
Text to be replaced: (.+) (.+) (.+) Replace with: \1 \3 \2 Use regular expressions: Tick Quick Summary: Define three groups (that's what the bracket pairs are for). Group 1: '(.+)' - the left group means look for any character (the dot), and repeat at least once (the '+' means one or more). Group 2: '(.+)' - the middle group means the same thing. Group 3: '(.+)' - the right group means the same thing again. However, regex is greedy so Group 1 will continue to grab as much as it can stopping only when there is the absolute minimum left over to satisfy the remainder of '<space> + Group 2 + <space> + Group 3'. This means that Group 1 will contain: Example 1: 'hello my friend, how are you ! -' Example 2: 'God does not play dice - 1926' and leave Groups 2 and 3 respectively as: Example 1: 'Bugs' and 'Bunny' Example 2: 'Albert' and 'Einstein' Then we take the first group and then swap the second and third groups with this: '\1 \3 \2' |
#3 : 11/02-16 12:45 Bernie2504
Posts: 17
|
Reply to #2:
Hi - it works really well - THX for the great help and the background informations ! Bernd |