1) lastname, firstname - title - idcode
2) idcode - lastname, firstname, title
3) idcode - title - lastname, firstname
OK - you've got 3 elements on each line, separated by ' - ' in 3 different patterns?
How do you tell which pattern you've got?
1) lastname, firstname - title - idcode
2) idcode - lastname, firstname, title
3) idcode - title - lastname, firstname
bobkoure wrote:So they're all something - something - something (i.e. 3 parts always separated by ' - ')?
First step, shuffle parts into the order you want.
^([^-]+)[ ]-[ ]([^-]+)[ ]-[ ]([^-]+)$
will grab all 3 "somethings" - and you can refer to them as \1, \2 and \3
So to change nothing, your output would be \1 - \2 - 3 (not that you would actually bother to do that - just trying to be clear here).
To convert pattern 2 to pattern 1, use the above regex with the output
\2 - \3 - \1
see how that works?
To convert pattern 3 to pattern 1, use the above regex with the output
\3 - \2 - \1
Of course, use BRU's very nice change-preview feature to see what you're going to get, make sure I haven't gotten the order wrong...
ScorpiousDelectus wrote: a way I can swap the "idcode" and "name" sections?
Each section is separated by the " - " deliminator.
Stefan wrote:ScorpiousDelectus wrote: a way I can swap the "idcode" and "name" sections?
Each section is separated by the " - " deliminator.
If you have an question you should provide real example file names incl. wanted example results
so one can give you an valid RegEx and not have to do the work twice.
Given on your last post i just guess:
Search for ALL till SpaceDashSpace
then for the next ALL till SPACE-SPACE
then for the next ALL till SPACE-SPACE
then... and so on, as often as you have parts divided by " - ".
The RegEx for to search for ALL is .+
But group this by () for an back-reference: (.+)
So use
RegEx(1)
Match: (.+) - (.+) - (.+) - (.+)
Replace: \1 - \3 - \4 - \2 or any order you like.
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
ScorpiousDelectus wrote:Stefan wrote:ScorpiousDelectus wrote: a way I can swap the "idcode" and "name" sections?
Each section is separated by the " - " deliminator.
If you have an question you should provide real example file names incl. wanted example results
so one can give you an valid RegEx and not have to do the work twice.
Given on your last post i just guess:
Search for ALL till SpaceDashSpace
then for the next ALL till SPACE-SPACE
then for the next ALL till SPACE-SPACE
then... and so on, as often as you have parts divided by " - ".
The RegEx for to search for ALL is .+
But group this by () for an back-reference: (.+)
So use
RegEx(1)
Match: (.+) - (.+) - (.+) - (.+)
Replace: \1 - \3 - \4 - \2 or any order you like.
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=27ScorpiousDelectus wrote:Example would be:
Sc8933-03 - Be As You Are - Chesney, Kenny.zip
The characters and number of characters vary in each segment, but are always separated by a " - "