Here is how I do it, in PHP:

$text =
preg_replace("/([.!?]|…)(”|’|\x22|\x27|\))?\s+([A-Z])/
", "\\1\\2  \\3", $text);
$text = preg_replace("/(Mr.|Mrs.|Ms.|Dr.|Drs.)  /", "\\1 ", $text);

(Of course this got all hammered by line-wrap in this email, but you get
the idea.)  First one looks for cases that need an extra space and puts
in "  ".  Second one fixes the overzealous Mr., Mrs., etc cases.

This works, handles the whole "inside quotes, parens, etc." problem,
even catches all the funky "smart quotes", and ellipses.  The "  "
makes line wrap still work.

Don't know why everyone seems to think this is so complicated.  Regular
expressions are your friend...

-----Original Message-----
From: Designer
Subject: Re: [WSG] Additional space between sentences ?

But can you point to an actual example of how to do 
this?  Apart from the (complex) problems of avoiding Mr. Mrs. etc, I 
often use PHP and this is riddled with 'periods' where I don't want 
spaces.  It seems to me to be a complex issue to select only ". "  and 
replace with ".  " ?  But then, you probably know something I don't!


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to