Kev Jackson wrote:
> given this string
>
> "    <td valign=\"top\">message</td>    <td valign=\"top\">the message
> to echo.</td>    <td valign=\"top\" align=\"center\">Yes, unless data
> is included in a character section within this element.</td>  </tr>  "
>
> how can I get this result
>
> ["message", "the message to echo.", "Yes, unless data is included in a
> character section within this element."]
>
> ?
>
> I've tried scan + regexp, but the best I've got so far is
>
> [["message"]]
>
> with this
>
> r.scan(/\">(\w+\s*)<\/td>/)
>
> Thanks
> Kev

If you really want sentences, this will work:

>> s.scan /\w+(?:[\s,]+\w+)*[.;?!]/
=> ["the message\nto echo.", "Yes, unless data is\nincluded in a character
section within this element."]
>> s.scan /\w+(?:,?\s+\w+)*[.;?!]/
=> ["the message\nto echo.", "Yes, unless data is\nincluded in a character
section within this element."]

Kind regards

    robert