Reply To: Smart Title Case

#52856

Oops. Gremlins Ate My Backslash! :-(

(^*)|(\<(?!(the|an?|in|to|o[rfn]|for)\>))

(It was the one right before '>' that went missing … this time.)

The Ye-Shall-Not-Find-This list is a bit obfuscated because of my shorthand notations:

an? = 'a', optionally followed by one 'n'

o[rfn] = 'o', followed by one of 'r', 'f', or 'n'

After that the word should end (A-M thought of that), which is done by the last \> code (End Word). If none of the above applies, the first lowercase character is matched.

The stuff at the start is “Beginning of line, any amount of whitespace (including zero), then a lowercase character. This ensures the first word is always capitalized — try it with “iPads are expensive toys” … (You'll see ID toggle between lowercase and uppercase while entering this.)

This article was last modified on May 25, 2010

Comments (0)

Loading comments...