Page 1 of 2

Another regex in replacement matrix

Posted: Wed Jul 24, 2013 5:41 am
by hopalongrock
For a long time I use Exceptions like ; 'A; 'B; 'C; .... to force uppercase for the beginning of word after blank and apostrophe.
I don't use ' as word separator, because the countless special cases, like don't, ev'rybody, etc.

These Exceptions don't work at the beginning of a field (no blank before '). For example in case of artists 'Wild' Bill Taylor , 'Frantic' Johnny Rogers or in case of title 'New' Bo Diddley, I have to write 'Wild', 'Frantic' , 'New' exactly into Exceptions, but it's not a general solution.

Now I try to force uppercase after apostrophe at the beginning of field with regex, assuming that ^ means the beginning of field:

Replace ^('[a-z]) with \u1 properly converts the first letter to uppercase in the artist and title tag ('Frantic' Johnny Rogers, 'New' Bo Diddley), but there is problem in the file name:

Using %A% - %T% - %L% - %R% format 'Frantic' is good, 'new' is wrong
'Frantic' Johnny Rogers - Sassy (Instr.) - Leapin' Guitars - 13.mp3
Bobby Brown - 'new' Bo Diddley - Rock Along Time - 24.mp3

Using %R% - %A% - %T% format 'frantic' and 'new' is wrong
13 - 'frantic' Johnny Rogers - Sassy (Instr.).mp3
24 - Bobby Brown - 'new' Bo Diddley.mp3

It seems that TGF treats the filename in this case as one string, ^ means here the beginning of filename, but the Exceptions doesn't prevail for the filename string.
So I think ^ should mean the beginning of the %A%, %T% parts.

Re: Another regex in replacement matrix

Posted: Wed Jul 24, 2013 1:12 pm
by hopalongrock
sorry, I can't find how to edit my message ....

The source of this problem, that quote " is forbidden in filename, and I don't want different tag and filename, I think I have to use apostrophe in tag and filename.

The best solution for me would be an option, to ignore ' when TGF determines the case, ie use the case, that would be without the apostrophe, for example if the string would be Abc without the quote, then use 'Abc, this way << Don't >> or <<'Mama' 'Papa'>> would be good result too.

Re: Another regex in replacement matrix

Posted: Wed Jul 24, 2013 4:28 pm
by jtclipper
You might be able to write a regex that capitalizes the first letter of words inside quotes, it could prove to be complex.
I am doing some work in proper case at this time so I can add an option to 'set the first letter to upper' for words inside quotes

Re: Another regex in replacement matrix

Posted: Wed Jul 24, 2013 6:52 pm
by hopalongrock
jtclipper wrote:I am doing some work in proper case at this time so I can add an option to 'set the first letter to upper' for words inside quotes
It would be great, thank you.

Re: Another regex in replacement matrix

Posted: Wed Jul 24, 2013 8:18 pm
by jtclipper
Beta updated with a few more proper case options, routine partially re-written.

Re: Another regex in replacement matrix

Posted: Thu Jul 25, 2013 5:42 am
by hopalongrock
My settings: ' (apostrophe) is not set in "Word separators", but set in "First letter always UPPER" option.
Works fine for words between apostrophes, like 'New' Bo Diddley , 'Frantic' Johnny Rogers , but doesn't works, when there is no closing apostrophe (no uppercase), for example 'cause I Love You .'til You Find A Love , instead of 'Cause I Love You , 'Til You Find A Love.

Re: Another regex in replacement matrix

Posted: Thu Jul 25, 2013 6:05 pm
by jtclipper
I am afraid those are quoted phases not words, or just a quote before a word.
I am sure they can be treated with a combination of exceptions and/or a regex matrix

Re: Another regex in replacement matrix

Posted: Thu Jul 25, 2013 9:19 pm
by hopalongrock
jtclipper wrote:I am afraid those are quoted phases not words, or just a quote before a word.
I am sure they can be treated with a combination of exceptions and/or a regex matrix
No problem, I have already the needed exceptions, I only tried to eliminate them, I thought you can do this easily.

But: TGF results 'cause and 'Cause' . I can't find any rule for the closing apostrophe.

Now I'm confused. There is no difference, if I disable or enable the "First letter always UPPER after" option, or if the apostrophe appears or doesn't appear in this option (if enabled), the result always the same: 'cause or 'Cause' .
Am I doing something wrong?
Or this option doesn't work at all ?

What is the exact meaning of this option ?
I think if I interpret the option literally, then << Don't >> should be << Don'T >> , which would not be desirable. (T is the first letter after apostrophe).

Re: Another regex in replacement matrix

Posted: Thu Jul 25, 2013 10:53 pm
by jtclipper
The "First letter always UPPER after" refers only for the lower case exceptions, I have placed it directly under but I will enclose in a group box to be more obvious.
For example if you have the word 'of' always lower and it starts after '.' then it will become 'Of'

What I could do though is when the option 'Quoted words always UPPER' is checked AND 'First letter always UPPER' then skip separators+quotes in the beginning so you get an Upper letter always in the start.

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 5:57 am
by hopalongrock
jtclipper wrote:The "First letter always UPPER after" refers only for the lower case exceptions, I have placed it directly under but I will enclose in a group box to be more obvious.
For example if you have the word 'of' always lower and it starts after '.' then it will become 'Of'
Understand, great !
jtclipper wrote:What I could do though is when the option 'Quoted words always UPPER' is checked AND 'First letter always UPPER' then skip separators+quotes in the beginning so you get an Upper letter always in the start.
I'm waiting for it, thanks in advance.

I think the option name "First letter Always Upper" (after Exceptions) is a bit confusing now, because of the new "First letter always UPPER after" option, maybe "First letter of Tokens Always Upper" would be better, as you call this option in the help.

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 7:59 pm
by jtclipper
Beta refreshed, the help file is not updated yet.

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 8:41 pm
by hopalongrock
Half success, it works fine when ' is at the field start, but doesn't work when ' is after a blank:
'Nuff Said
'Til The End Of The World
'Cause I Love You

Thinkin' 'bout
How Long, How True, 'til Then
Rock 'til I Drop

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 9:08 pm
by jtclipper
Yes the change is supposed to affect the First letter of the text being formatted.

For the other scenarios it's different, what can be done to avoided setting ' as a separator and mess up words like "don't" is to add a sub option for the 'Quoted words always UPPER".
Something like 'Incomplete Quotes also'

So in this sample "Rock 'til I Drop" since 'til is basically a word it will be treated properly.

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 9:17 pm
by hopalongrock
jtclipper wrote:add a sub option for the 'Quoted words always UPPER".
Something like 'Incomplete Quotes also'
That's it !

Re: Another regex in replacement matrix

Posted: Fri Jul 26, 2013 10:52 pm
by jtclipper
Refreshed the beta again