Thread: Regex examples
View Single Post
Old 08-10-2014, 03:29 AM   #388
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
My previous code assumed a word was preceded by a space, but I stuck in a check for NOT opening guillemet. Also, using DiapDealer's unicode codepoints.

Find:
Code:
(?<![.!?«])(?<=[ ])(\p{Lu})(?=\p{Ll}+)
Replace:
Code:
\L\1
Finds a space, capital letter, lowercase letter, assuming it is not proceeded by punctuation types:
.!?«

Does that work? If not, I'll try to come up with something more inspired in the morning.

Last edited by eschwartz; 08-10-2014 at 03:34 AM.
eschwartz is offline   Reply With Quote