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

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
(?:frowning:?<=\s-\s)|^)(.*?)(?=$|\s-\s)
Replace matches with: $caps3($1)

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

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)

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

No, it is a code given to me here /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 ' - '

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

Great thank you. I have no more problem.