There's no way to get a regular expression to assign capture group results to separate destinations. You can work with returned match locations but in this case there's easier ways to do what you want.
If you're okay with standardizing the 'featuring' representation, you can do the following without using a regex:
1: Copy the Artist field to Variable 0
2: Replace first occurrence of "featuring|feat.", case insensitive, match words, OR matching in Variable 0 with "\&0000"
3: Split Variable 0 at delimiter "\&0000" save right portion to Variable 1
4: Set for last name, first name in Variable 0
5: if Variable 1 is not empty
6: Set for last name, first name in Variable 1
7: Append "·feat. \v1" to Variable 0
8: endif
9: Copy the Variable 0 field to the Sort Artist field
Statement 1 copies Artist to Variable 0 so that Artist is not changed by subsequent manipulations
Statement 2 looks for the first occurrence of case insensitive 'featuring' or 'feat.' on word boundaries and replaces the sequence with a binary 0. (You can replace it with anything that wouldn't normally be in the field)
Statement 3 splits the Variable 2 field at the binary 0. Variable 0 gets everything before and Variable 1 gets everything after. Variable 0 has trailing spaces removed and Variable 1 has leading spaces removed. If the binary 0 is not found, Variable 1 will be empty.
Statement 4 sorts the front end or the entire field.
Statement 5 is an If statement. It limits execution to those statements which had the featuring text.
Statement 6 sorts the tail end
Statement 7 modifies Variable 0 by appending space feat. space Variable 1
Note you can choose whatever you like other than feat.
Statement 8 ends the file limiting stared on statement 5.
Statement 9 sets the Sort Artist field.
As an aside I notice that you have disabled Prompt statements which were intended for debugging. The Debug statement is a better approach as it can be configured when displayed to display anything 🙂
|