Case Conversion with regex


#1

First of all, this program is great. Thanks for working so hard.

Anyway, this is what I have a problem with.
I am trying to convert cases of tags to mixed tags.

Example)
I AM SO gooD And a Dog of John -> I Am So Good And A Dog Of John
:This is how you get when you use mixed conversion.

I do not want some of words to convert to Mixed cases, such as A, An, Of.
So my target is something like this...

Target)
I Am So Good and a Dog of John

I put this regular expression after mixed case conversion

Regex (.*) (a |the |of |to |an |and ) and replace with $1 \l$2

But this doesn't work as I wanted it to be

Result)
I Am So Good And A Dog of John

The expression above just convert last a, an, of or whatever, but ignores any words before that.

Would you please let me know how I can manage this?


Changing Small Words Case
#2

Try this approach:


Schreibweise einzelner Wörter ändern - Wie gehts?
#3

Thanks, Dano! It works and very simple. GREAT!!


#4

I tried to add to this so that it won't change to lower case when the word follows a colon, parenthesis, dash or bracket.

(e.g. (This Could Be) The Last Time; Alpha Omega (The Beginning); Interstellar Overdrive: The Alternate Masters)

So I added to RegExp: [^:()[]-]\s(a|the|of|to|an|and)(?=\s)
and left Replace as: $lower($0)

This seemed to work fine until it came across "Yes, The River Knows"

The comma seems to cause a problem: instead of "Yes, the River Knows" I get "Yes River Knows"

I haven't been able to get it to work right, can anyone help out? Thanks.


#5

I figured it out.


#6

Good for you, but you might want to tell the others!
Not really a useful post without the information.