# REGEX importing artist name from directory path

**URL:** https://community.mp3tag.de/t/regex-importing-artist-name-from-directory-path/19469
**Category:** General Discussion
**Created:** [October 24, 2017, 4:35pm UTC](https://community.mp3tag.de/t/regex-importing-artist-name-from-directory-path/19469 "2017-10-24T16:35:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![andpeterson](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@andpeterson](https://community.mp3tag.de/u/andpeterson)
#### Post date: [October 24, 2017, 4:35pm UTC](https://community.mp3tag.de/t/regex-importing-artist-name-from-directory-path/19469/1 "2017-10-24T16:35:31Z")

</div>

Just giving this to others as I have spent the past 3 days learning regular expressions and attempting to make this work.

```
Action Type: Format Value
Field: ARTIST
Format String: $regexp(%_Path%,.*\\\\Music\\\\(\w+).*,$1)

```

Since my music directory is really organized I can pull a lot of info straight from my directory path. This line here pulls the folder name after the \Music\ folder and stores it in the ARTIST tag.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [October 25, 2017, 1:00am UTC](https://community.mp3tag.de/t/regex-importing-artist-name-from-directory-path/19469/2 "2017-10-25T01:00:23Z")

</div>

> [@andpeterson](#):
>
> ... I have spent the past 3 days learning regular expressions ... This line here pulls the folder name after the \Music\ folder ...

This regular expression works for foldernames with more than one word:  
$regexp(%\_path%,'^._\\Music\\(.+?)\\._','$1')

DD.20171025.0500.CEST
