View Single Post
Old 11-10-2010, 06:18 PM   #10
Carl314
Enthusiast
Carl314 began at the beginning.
 
Posts: 39
Karma: 10
Join Date: Mar 2009
Device: Kindle 3, Motorola Droid with Aldiko
I'm not a regex guru, but I think this search/replace should at least insert the italics tag around capital letters (I don't know how to convert upper to lower case, however - perhaps set up a css lower case class for your italics tag if there's no other way?)

Search (case sensitive) for: ([ >“‘])([^a-z]+)([ <”’])
Replace: \1<i>\2</i>\3.

It will search for a block of text which contains at least two characters, and no lower case (but punctuation and numbers are okay) book-ended by either spaces, open/close tag signs, or quotation marks, an then insert the <i></i> around the text.

If you know you're only searching for caps, with no numbers or punctuation, then replace the text search term to [A-Z]+

Hope this helps.

Cheers, Carl.
Carl314 is offline   Reply With Quote