Hi Jim,

> Actually, I would like to match "fred" followed by
> anything but "fred". In other words, my string is of the form
> 
> <<EOF
> fred
> some line 1
> some line 2
> fred
> some line x
> some line y
> fred
> ...
> EOF
> 
> I would like the string broken into array elements with
> (in this case) three lines per element.
> 
> So, I am not sure how to look for multiple characters /fred[^fred]/
> will not work, of course.

In this case I'd use String#split to split the string at fred:

irb(main):001:0> s = <<EOF
irb(main):002:0" fred
irb(main):003:0" some line 1
irb(main):004:0" some line 2
irb(main):005:0" fred
irb(main):006:0" some line x
irb(main):007:0" some line y
irb(main):008:0" fred
irb(main):009:0" ...
irb(main):010:0" EOF
"fred\nsome line 1\nsome line 2\nfred\nsome line x\nsome line y\nfred\n...\n"

First try:

irb(main):011:0> s.split(/fred/)
["", "\nsome line 1\nsome line 2\n", "\nsome line x\nsome line y\n", "\n...\n"]

This doesn't yield the fred lines, 'cause the fred is consumed by the RE, so try 
with "zero-width positive lookahead":

irb(main):012:0> s.split(/(?=fred)/)
["fred\nsome line 1\nsome line 2\n", "fred\nsome line x\nsome line y\n", "fred\n
...\n"]

This splits the String at "fred"s, but doesn't consume the "fred"s.

Regards,
Pit