Capitalizing last word


#1

I want to write an action that capitalizes song titles according to these rules:

http://aitech.ac.jp/~ckelly/midi/help/caps.html

It's not very advanced yet... but I had to think of a first potential problem already.

First I use $caps2, then I use simple matches "A"->"a", "The"->"the" and so on... but when the last word in a string is one of those matched words, how do I make sure it is capitalized at the end of the script again?

For the first letter of the string I can simply use "(^.)"->"$upper($1)", but there seems to be no way to match a whole word or is there? Match the string between the last whitespace and end-of-line ($)? But how do I do that?

EDIT: I've found it: "\b\w*$"


#2

I'm just curious: Do you know if such rules exist for the german language too?


#3

Yes, I'm sure but I don't know where to find them on the net. :frowning:

It's not as easy to implement such rules anyway. For example I can't write a regular expression that is able to distinguish between nouns, verbs, prepositions and so on... :wink: