x = <<MY_DELIMITER
We like Ruby
They adore Ruby
Everyone loves Ruby
MY_DELIMITER

#changes the first line only (from 'We'to 'Do you')
puts x.sub(/^../, 'Do you')

puts

#ALSO changes the first line only, but anchors at the end of the line
(from 'Ruby' to 'Rubic')
puts x.sub(/.$/, 'ic')

--------------------------------------------------------------------------------
So what does the author mean by "beginning of any lines" in page 45,
third paragraph of his book?

"The ^ is an anchor, meaning the regular expression
will match from the beginning of any lines within the string."

I'm also having a bit of trouble using the syntax \A and \Z.  Can
anybody show how it's done please?

Thank you very much.
Peter Cooper Rocks!
-- 
Posted via http://www.ruby-forum.com/.