Dav Jones wrote: > Thanks. I've got it reading in a file and checking each line against a > regular expression. > > How would I go about taking individual sections of a line? > i.e. if the word 'example:' appears on a line then it takes that and a > few characters before or after it (it will be something specific its > just the question is in general here) so for > blah blah blah example: twenty blah blah > it returns me 'example: twenty' ---------------------------------- #!/usr/bin/ruby -w data = "blah blah blah blah example: twenty blah blah blah blah" result = data.scan(%r{(example: \w+)}).flatten puts result ---------------------------------- output: example: twenty -- Paul Lutus http://www.arachnoid.com