gga wrote:
> I am usually pretty good at regexes but this one has me stumped.
> I want to basically match any line that has a period in it, but only if
> that period is not part of a salutation.  Ideally I want to do this
> with a single regex.
>
> Thus:
> 'end of line. And we continue'    # should match
> 'The incredible Mrs. Robner'      # should not match
> 'Sammy Davis Jr. is an okay guy.' # should match, due to last .
>
> I tried doing something logical, like:
>
> /(?!Jr\.|Sr\.|Miss\.|Mr\.|Mrs\.)\./
>
> but, alas, this does not work.  Any ideas?

a = [
 'end of line. And we continue',
'The incredible Mrs. Robner',
'Sammy Davis Jr. is an okay guy.'
]

a.each {|s|
  puts s if s.gsub(/(?:Jr\.|Sr\.|Mr\.|Mrs\.)/,"") =~ /\./
}