# Code error for a capital after a space, dash 6, a space.

**URL:** https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788
**Category:** Support
**Created:** [April 1, 2015, 11:44am UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788 "2015-04-01T11:44:56Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)
#### Post date: [April 1, 2015, 11:44am UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/1 "2015-04-01T11:44:56Z")

</div>

Hello, I have a code to put a capital letter at the beginning of a sentence after '- it works well but I met a problem for the form of the following title:

Title: This is halloween (orchestra - only version)

After the convertion: This is halloween (orchestra) - only version

It should rather be: This is halloween (orchestra - Only Version)

Code I have:

Regular expression:  
CODE  
(?☹?\<=\s-\s)|^)(.\*?)(?=$|\s-\s)  
Replace matches with: $caps3($1)

---

<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: [April 1, 2015, 12:24pm UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/2 "2015-04-01T12:24:26Z")

</div>

> [@Sylvain.dmde](#):
>
> Hello, I have a code to put a capital letter at the beginning of a sentence after '- it works well but I met a problem for the form of the following title ...

**This regular expression ... (?:(?\<=\s-\s)|^)(.\*?)(?=$|\s-\s) does not match for both examples ... $regexp('This is Halloween (Orchestra - only version)',** 

**```
    <!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->(?:(?<=\s-\s)|^)(.*?)(?=$|\s-\s):<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->$1<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->)<!--colorc--></span><!--/colorc-->
                      <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->===<!--colorc--></span><!--/colorc-->
                      <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->$1<!--colorc--></span><!--/colorc-->**

**```**

 **$regexp('This is Halloween (Orchestra) - only version',** 

**```
    <!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->(?:(?<=\s-\s)|^)(.*?)(?=$|\s-\s):<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->$1<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->)<!--colorc--></span><!--/colorc-->
                      <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->===<!--colorc--></span><!--/colorc-->
                      <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->$1<!--colorc--></span><!--/colorc--></b><!--fontc--></span><!--/fontc--><!--sizec--></span><!--/sizec-->**

**```**

 

Please explain in other words and examples, what you want to achieve.

 

DD.20150401.1644.CEST

---

<div class="post-metadata">

### Author: ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)
#### Post date: [April 1, 2015, 3:38pm UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/3 "2015-04-01T15:38:19Z")

</div>

With this code:

Field: TITLE  
Regular expression:

```
(?:(?<=\s-\s)|^)(.*?)(?=$|\s-\s)

```

Replace matches with:

Sentence Case  
$caps3($1)  
Result: Dire straits - Sultans of swing

he should put my titles capitalized beginning of a sentence but after ' - '. It makes me well except in one case:

Title: This is halloween (orchestra - only version)

Result: This is halloween (orchestra) - only version

It shoulds rather be: This is halloween (orchestra - Only Version)

---

<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: [April 1, 2015, 4:20pm UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/4 "2015-04-01T16:20:21Z")

</div>

> [@Sylvain.dmde](#):
>
> ... put my titles capitalized beginning of a sentence but after ' - '. It makes me well ...

You may try something like this ...

**Action "Format value" Field: TITLE Formatstring: $regexp(%TITLE%,'\b.','\u$0') From: TITLE = 'This is Halloween (Orchestra - only version)' To: TITLE = 'This Is Halloween (Orchestra - Only Version)' Action "Format value" Field: TITLE Formatstring: $regexp($regexp(%TITLE%,'\b.','\u$0'),'(?\<!^)\b(is|on|to|from|of|this)\b','\l$1',1) From: TITLE = 'This is Halloween (Orchestra - only version)' To: TITLE = 'This is Halloween (Orchestra - Only Version)'**

DD.20150401.2020.CEST

---

<div class="post-metadata">

### Author: ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)
#### Post date: [April 1, 2015, 8:41pm UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/5 "2015-04-01T20:41:09Z")

</div>

No, it is a code given to me here [/t/16302/1](https://community.mp3tag.de/t/16302/1)

by Victor Kostas  
Post November 9, 2014, 12:21

I give you but it is good but in the case seen above it is not anymore.

Field: TITLE  
Regular expression:

```
(?:(?<=\s-\s)|^)(.*?)(?=$|\s-\s)

```

Sentence Case  
$caps3($1)  
Result: Dire straits - Sultans of swing

I would like to start a capital sentence, but not at the beginning of each word. And capital at the beginning of ' - '

---

<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: [April 2, 2015, 3:17am UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/6 "2015-04-02T03:17:05Z")

</div>

> [@Sylvain.dmde](#):
>
> ... I would like to start a capital sentence, but not at the beginning of each word. And capital at the beginning of ' - '

**Title From: this is halloween (orchestra - only version) To : This is halloween (orchestra - Only Version)** 

**```
  <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->= =<!--colorc--></span><!--/colorc-->**

**```**

 **Proposal: Apply a modified function $caps3 (sentence case). Step 1: Because the space character ' ' is the separator character between words, ... and the space should not trigger each word ... to be set having a starting uppercased letter, ... therefore the existing separator string ' - ' ... has to be changed into some other separator string, ... which will allow to apply the function $caps3. Formatstring: $replace(%TITLE%,' - ',' -') Result: 'this is halloween (orchestra -only Version)' Step 2: Now it is possible to apply function $caps3 ... Formatstring: $caps3(%TITLE%,'-') Result: 'This is halloween (orchestra -Only Version)' Step 3: Repair the previously changed separator string from ' -' to ' - ' Formatstring: $replace(%TITLE%,' -',' - ') All steps into one formatstring ... Action "Format value" Field: TITLE Formatstring: $replace($caps3($replace(%TITLE%,' - ',' -'),'-'),' -',' - ') ... or ... Formatstring: $replace($caps3($replace(%TITLE%,' - ',$char(7)),$char(7)),$char(7),' - ')**

DD.20150402.0717.CEST

---

<div class="post-metadata">

### Author: ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)
#### Post date: [April 2, 2015, 7:26am UTC](https://community.mp3tag.de/t/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/7 "2015-04-02T07:26:48Z")

</div>

Great thank you. I have no more problem.

---

<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/code-error-for-a-capital-after-a-space-dash-6-a-space/16788/8 "2026-02-09T12:25:37Z")

</div>


