scan a here document : scan « String « Ruby
- Ruby
- String
- scan
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
Related examples in the same category