# Replace the letter a with To if it is located between two groups of digits

**URL:** https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505
**Category:** Support
**Created:** [April 25, 2024, 8:28am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505 "2024-04-25T08:28:13Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![corrado63](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@corrado63](https://community.mp3tag.de/u/corrado63)
#### Post date: [April 25, 2024, 8:28am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/1 "2024-04-25T08:28:13Z")

</div>

Hi, I have this situation  
I want , es, XXaYY becomes XX To YY  
I thinks to use "Replace with Regular Expression]" but I can't find the syntax

 ![image](https://community.mp3tag.de/uploads/default/original/3X/3/8/3823b4d64df97be637dcaa06a7bd5b198a24880f.png)  
Thanks for all guys

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [April 25, 2024, 8:40am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/2 "2024-04-25T08:40:25Z")

</div>

You want to replace  
two characters (whatever they are)  
followed by the letter  
a  
followed by two characters (whatever they are)

and they should become  
two letters  
space  
To  
space  
two letters

Is this correct?  
Do the two characters also have to be UPPERCASE and the character a lowercase?

---

<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: [April 25, 2024, 8:48am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/3 "2024-04-25T08:48:38Z")

</div>

> [@corrado63](#):
>
> I want , es, XXaYY becomes XX To YY

Try Convert\>Tag-Tag for TITLE :  
Format string: `$regexp(%title%,(.*\d\d)a(\d\d),$1 To $2)`

---

<div class="post-metadata">

### Author: ![corrado63](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@corrado63](https://community.mp3tag.de/u/corrado63)
#### Post date: [April 25, 2024, 8:53am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/4 "2024-04-25T08:53:32Z")

</div>

no, I just want to replace the letter "a" with "To" if the letter a is between a group of 2 or three digit numbers (these are the Bpm).  
Ex... 90a100 becomes 90 To 100  
Thanks

---

<div class="post-metadata">

### Author: ![corrado63](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@corrado63](https://community.mp3tag.de/u/corrado63)
#### Post date: [April 25, 2024, 8:58am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/5 "2024-04-25T08:58:06Z")

</div>

> [@ohrenkino](#):
>
> $regexp(%title%,(.\*\d\d)a(\d\d),$1 To $2)

PER-FE-CT !!!  
THANKS so much

 ![image](https://community.mp3tag.de/uploads/default/original/3X/a/2/a25037dd7c5dbc21b22fe2ba8d2cd75fde88adf7.png)

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [April 25, 2024, 9:04am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/6 "2024-04-25T09:04:50Z")

</div>

Even if your solution also works for a value with more then 2 digits, I would suggest to use  
`$regexp(%title%,(.*\d+)a(\d+),$1 To $2)`  
 ![image](https://community.mp3tag.de/uploads/default/original/3X/0/2/025cf65833d31c8a6107048cb0b9b6d749eaa22e.png)

---

<div class="post-metadata">

### Author: ![corrado63](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@corrado63](https://community.mp3tag.de/u/corrado63)
#### Post date: [April 25, 2024, 9:19am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/7 "2024-04-25T09:19:30Z")

</div>

> [@LyricsLover](#):
>
> $regexp(%title%,(.\*\d+)a(\d+),$1 To $2)

thanks again, I will study the formula to apply it in other situations

---

<div class="post-metadata">

### Author: ![Casual\_Tea](https://community.mp3tag.de/user_avatar/community.mp3tag.de/casual_tea/32/18886_2.png) [@Casual\_Tea](https://community.mp3tag.de/u/Casual_Tea)
#### Post date: [April 25, 2024, 10:27pm UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/8 "2024-04-25T22:27:23Z")

</div>

> [@LyricsLover](#):
>
> $regexp(%title%,(.\*\d+)a(\d+),$1 To $2)

Is there a reason for including the start of the title in the match but not the end?

I've just tested it and your version which matches the start but not the end:

```auto
$regexp(%title%,(.*\d+)a(\d+),$1 To $2)

```

this one that only matches the numbers and "a":

```auto
$regexp(%title%,(\d+)a(\d+),$1 To $2)

```

and this version matching the entire title:

```auto
$regexp(%title%,^(.*\d+)a(\d+.*)$,$1 To $2)

```

All yielded the same result in a Convert → Tag - Tag action in mp3tag.  
Personally I'd either use the easiest and shortest one that only matches the numbers and "a" or the most precise one that matches the entire string.

Visualized the version matching the entire title looks like this:

 ![grafik](https://community.mp3tag.de/uploads/default/original/3X/1/f/1f27b3746f692b4066180b87db648bbf6ff89d1b.png)

---

<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: [April 26, 2024, 7:37am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/9 "2024-04-26T07:37:46Z")

</div>

> [@Casual\_Tea](#):
>
> this one that only matches the numbers and "a":
> 
> `$regexp(%title%,(\d+)a(\d+),$1 To $2)`

Yes, this would have been enough.  
But as you see: there are so many ways to skin a cat.

---

<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: [May 26, 2024, 7:38am UTC](https://community.mp3tag.de/t/replace-the-letter-a-with-to-if-it-is-located-between-two-groups-of-digits/64505/10 "2024-05-26T07:38:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
