Another regex in replacement matrix
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Another regex in replacement matrix
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.
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.
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
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.
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
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
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
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
It would be great, thank you.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
Re: Another regex in replacement matrix
Beta updated with a few more proper case options, routine partially re-written.
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
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.
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
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
I am sure they can be treated with a combination of exceptions and/or a regex matrix
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
No problem, I have already the needed exceptions, I only tried to eliminate them, I thought you can do this easily.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
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
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.
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.
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
Understand, great !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'
I'm waiting for it, thanks in advance.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 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
Beta refreshed, the help file is not updated yet.
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
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
'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
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.
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.
-
- Sr. Member
- Posts: 294
- Joined: Wed Sep 15, 2010 1:38 pm
Re: Another regex in replacement matrix
That's it !jtclipper wrote:add a sub option for the 'Quoted words always UPPER".
Something like 'Incomplete Quotes also'
Re: Another regex in replacement matrix
Refreshed the beta again