# match 3 lines keep line 2 and 3

**URL:** <https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933>\
**Category:** Support\
**Created:** [July 23, 2014, 9:51am UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933 "2014-07-23T09:51:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ForSSound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/258eb7/32.png) [@ForSSound](https://community.mp3tag.de/u/ForSSound)\
**Post date:** [July 23, 2014, 9:51am UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/1 "2014-07-23T09:51:37Z")

</div>

Hi There,

Below is a example of the metadata I'm trying to reformat.  
In this case I would like to keep line 2 and 3.  
I would like it to work whatever is written.

I found a site that let me test the regular expressions [http://regex101.com/#python](http://regex101.com/#python)

Here I tried it with:  
^(._)/n(._)/n(._)/n  
^(._\n)(._\n)(._\n)  
^(._\n|\r)(._\n|\r)(.\*\n|\r)

This is the data to be tested:

```
LC 13373
AFRICA ETHNIC POP ETHNO POP
MID, walk,
MEDIUM, marche,
---------------------------------------------------------------------------
All rights reserved
Producer publisher
PARSIPARLA
3 rue des Aulnes
03000 AVERMES
FRANCE
tel fax 33 (0)4 70 20 65 10
info@parsiparla.com
www.parsiparla.com

```

In the site the 3 reg expr worked:  
But when I apply one in mp3tag it doesn't

**reg exp:** ^(._)/n(._)/n(.\*)/n  
**replace by:** $2$3

This is the result from the test in mp3tag:

```
tel fax 33 (0)4 70 20 65 10
info@parsiparla.com
www.parsiparla.com

```

Thanks for reading and I hope somebody can point me to my errors.

Kind Regards  
Guy Forssman

---

<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:** [July 23, 2014, 10:14am UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/2 "2014-07-23T10:14:09Z")

</div>

Due to the greadiness I would not recommend a regular expression but a "Format value" action for the respective field.  
I used COMMENT as container for the test data:

$mid(%comment%,$strstr(%comment%,$char(13)$char(10)),$len(%comment%))

---

<div class="post-metadata">

**Author:** ![ForSSound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/258eb7/32.png) [@ForSSound](https://community.mp3tag.de/u/ForSSound)\
**Post date:** [July 23, 2014, 12:48pm UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/3 "2014-07-23T12:48:42Z")

</div>

Thank You very much worke like a charm

---

<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:** [July 23, 2014, 12:54pm UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/4 "2014-07-23T12:54:58Z")

</div>

> [@ForSSOund](#):
>
> ... I would like to keep line 2 and 3. ...

Example:  
Multi-line field TEST = line 1line 2line 3line 4line 5  
line 1  
line 2  
line 3  
line 4  
line 5

RESULT \<== **$regexp(%TEST%,'\A._?\r?\n(._?\r?\n)(._?\r?\n)._?\Z','$1$2')**  
RESULT = line 2line 3  
... or ...  
RESULT \<== **$regexp(%TEST%,'\A._?\r?\n((?:._?\r?\n){2}).\*?\Z','$1')**  
RESULT = line 2line 3

Use Convert "Tag - Tag" for preview.

DD.20140724.1655.CEST

---

<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:** [July 23, 2014, 1:26pm UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/5 "2014-07-23T13:26:22Z")

</div>

> [@ForSSOund](#):
>
> ... I would like to keep line 2 and 3. ...

Example:  
Multi-line field TEST = line 1line 2line 3line 4line 5  
line 1  
line 2  
line 3  
line 4  
line 5

**TEMP \<== $replace(%TEST%,$char(13)$char(10),'\\\\') ... or ... TEMP \<== $regexp(%TEST%,'\r\n','\\\\')****LINE2 \<== $meta(TEMP,1) LINE3 \<== $meta(TEMP,2)**

Remove TEMP

DD.20140723.1726.CEST

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:25pm UTC](https://community.mp3tag.de/t/match-3-lines-keep-line-2-and-3/15933/6 "2026-02-09T12:25:09Z")

</div>

Closed on February 9, 2026, 12:25pm UTC


