Date: Tue, 16 Jan 2007 18:43:33 +0100
Reply-To: Martin Gregory <gregorym@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Martin Gregory <gregorym@T-ONLINE.DE>
Organization: T-Online
Subject: Re: detect dots as end of sentence
In-Reply-To: <BAY103-F21493DA6D29573AF2C518CB0B40@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> More general would be to use the regular expression that Emacs uses for
>> end of sentence:
>>
>> [.?!][]\"')]*($| $|\t| )[ \t\n]*
>>
>> and use this instead of the \. in Alan's suggestion.
>>
>> -Martin
>>
>
> Are you sure there are no typos in the above regex?
> At a minimum, the second character class ought to be
>
> [\]"')]*
>
> instead, because otherwise it will end at the interior
> right bracket instead of the one on the right.
Apart from removing the \\ that elisp requires, I copied it from the
Emacs info node on regular expressions. Although I see now I should also
have removed the \ before the double quote. If you break it down into
pieces:
[.?!] period, question or exclamation mark followed by
[]"')]* any number of closing brackets or quotes
You can use a literal ] in a list without escaping if it's the first
character in the list.
-Martin
|