I make use of an action in conjunction with a regex to generate Firstlettercaps strings for all words in a string, excepting a predefined list of words which should always be formatted lowercase. The regex works for the most part, but I do get exceptions, e.g. "I'm" and/or "i'm" returns "I'M" instead of "I'm". As it turns out, I'm unable to spot my error, so I'm hoping someone out there can give me a hand. Here's the code:
Firstly, I apply a case conversion Mixed case action, with words beginning after any of: .([/"
Then I apply a regex as follows:
\b(?:M{0,3})(?:D?C{0,3}|C[DM])(?:L?X{0,3}|X[LC])(?:V?I{0,3}|I[VX])(?=(\.\s|\s|\)|$))
replace matches with $upper($0)
followed by another regex as follows:
\s(a|an|and|as|at|by|but|de|di|en|for|from|in|is|of|on|op|or|out|the|to|van|
with)(?=\s)
replace matches with $lower($0)
Hmm, now if only I could edit the topic header or delete the post I'd correct the subject error!
Your actions work for the most cases, and you got only a few exceptions?
Then add some action to handle the exceptions, e. g. simply replace "I'M" with "I'm".
$regexp('I''''m so dizzy about mclxi''''s letters','[^''''|\b](?i:(?=[MDCLXVI])((M{0,3})((C[DM])|(D?C{0,3}))?((X[LC])|(L?XX{0,2})|L)?((I[VX])|(V?(II{0,2}))|V)?))[\b|^'''']','\U$0')
From:
I'm so dizzy about mclxi's letters
To:
I'm so dizzy about MCLXI's letters
Same as above wrapped into an action:
Action #1 Actiontype 4: Replace with regular expression Field: EGD Regular expression: ^'|\b[\b|^'] Replace matches with: \U$0