# Importing actions from Windows

**URL:** <https://community.mp3tag.de/t/importing-actions-from-windows/58567>\
**Category:** Mac\
**Created:** [September 24, 2022, 2:43am UTC](https://community.mp3tag.de/t/importing-actions-from-windows/58567 "2022-09-24T02:43:15Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 24, 2022, 7:05am UTC](https://community.mp3tag.de/t/importing-actions-from-windows/58567/8 "2022-09-24T07:05:08Z")

</div>

What i said was that the code that you supplied with that hard to read listing does not lead to the expected result of swapping words.

I would use 2 actions of the type "Format value" for the artistsort field:  
Format string: `$regexp(%artist%,'(.*) (.*) (.*)','$2, $3 $1')`  
and the next:  
Format string: `$regexp(%artist%,'(.*?) (.*)','$2, $1')`

Edit: why was it necessary to import the actions from Windows as you got a solution for the Mac already:

> [@AlbumArtistSort and ArtistSort - switch first and last names](https://community.mp3tag.de/t/albumartistsort-and-artistsort-switch-first-and-land-names/55992/14):
>
> I had a look at the expression used in #17 and it seems to me that an escape of the opening bracket in the first match group is missing. A correct expression would be ^([^,\[]+)\s([^,\[]+)$ The same applies to the expression using in #18 ^([^,\[]+)\s([^,\[]+)\s(\[.+\])$

---

_[View the full topic](https://community.mp3tag.de/t/importing-actions-from-windows/58567)._
