From: Jim Date: 2008-01-31T07:49:57+09:00 Subject: Re: Newbie: working with binary files/extract png from a binary file Thank you both for your information and effort. Adam, your code worked out of the box. Tell me you didn't write that off the top of your head? fp = File.new("has_embedded_png.dat","rb") # fp is a file pointer m= /\211PNG/.match(fp.read) # (fp.read) is a String of binary data. Using a regular ex. to locate the PNG header raise "no PNG" if !m # exception if there is not a header match fp.seek(m.begin(0)) # I understand seek, Not sure what m.begin(0) is actually doing? Docs say: Returns the offset of the start of the nth element of the match array in the string. I still don't get it.