# replace with regular expression problem

**URL:** https://community.mp3tag.de/t/replace-with-regular-expression-problem/3835
**Category:** Support
**Created:** [September 30, 2006, 4:09pm UTC](https://community.mp3tag.de/t/replace-with-regular-expression-problem/3835 "2006-09-30T16:09:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mhuessy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/e68b1a/32.png) [@mhuessy](https://community.mp3tag.de/u/mhuessy)
#### Post date: [September 30, 2006, 4:09pm UTC](https://community.mp3tag.de/t/replace-with-regular-expression-problem/3835/1 "2006-09-30T16:09:23Z")

</div>

hi,

I have a work-around for this, but I don't understand what the problem really is, and why I have solved it. Can anyone teach me?

1- What is being "falsely recognized" in the (.\*) case?  
2- Why does [^] start of a line anchor solve the problem?

* * *

Problem:

title: 01 - Love's a Precious Thing One Strange Sunday

using replace with regular expression

field: title  
regular expression: (.\*)  
replace match with: junk $1

Produces: junk 01 - Love's a Precious Thing One Strange Sundayjunk

```
(The problem is the trailing added "junk")

```

* * *

Solution: use start of line anchor [^]

field: title  
regular expression: ^(.\*)  
replace match with: junk $1

Produces:  
junk 01 - Love's a Precious Thing One Strange Sunday

* * *

!!! end of line anchor [$] didn't work

field: title  
regular expression: (.\*)$  
replace match with: junk $1

Produces:  
Produces: junk 01 - Love's a Precious Thing One Strange Sundayjunk  
with the trailing added "junk"

I don't understand why front anchor works, as the "bad" replace is at the end of line & supposedly "." matches everything EXCEPT new line  
I thought there must be a false recog & replace of the new line character.

---

<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 1, 2006, 3:57am UTC](https://community.mp3tag.de/t/replace-with-regular-expression-problem/3835/2 "2006-10-01T03:57:40Z")

</div>

> [@mhuessy](#):
>
> Problem:  
> title: 01 - Love's a Precious Thing One Strange Sunday  
> using replace with regular expression  
> field: title  
> regular expression: (.\*)  
> replace match with: junk $1  
> Produces: junk 01 - Love's a Precious Thing One Strange Sundayjunk
> 
> ```
> (The problem is the trailing added "junk")
> 
> ```

Other testcases:

title: **TestTitle**  
using replace with regular expression  
field: **TITLE**  
regular expression: **.\***  
replace match with: **junk $0**  
Produces: **junk TestTitlejunk**

For me it looks and feels like a bug.

title: **TestTitle**  
using replace with regular expression  
field: **TITLE**  
regular expression: **.+**  
replace match with: **junk $0**  
Produces: **junk TestTitle**

This solves the problem in the case that there exists minimal one character in the TITLE tag.

DD.20061001.0754

---

<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:19pm UTC](https://community.mp3tag.de/t/replace-with-regular-expression-problem/3835/3 "2026-02-09T12:19:54Z")

</div>


