scan a here document
#!/usr/bin/env ruby sonnet = <<129 this is a test this is another test 129 result = sonnet.scan(/^test/) result << sonnet.scan(/test;$/) puts result