From: Robert Dober Date: 2011-02-27T22:12:41+09:00 Subject: Re: finding a tag in a binary file On Sun, Feb 27, 2011 at 12:34 PM, rob stanton wrote: > wow a little beyond my just started status... So the array you created > has a coupe of 10 00 10 00 in correct ? > then I don't know what you did with it and you got ab bc ? thanks but > could you explain a little more I'm new to this > right I created a string like "a\n\0\n\0bc..." than I used String#scan to get all matches of the regular expression matching \n\0\n\0 followed by a non empty sequence of word characters (\w+) which I grouped. To demonstrate what that does let us look at this code ( I got rid of one \n\0 for laziness ;) content.scan /\n\0\w+/ => ["\n\x00ab", "\n\x00bc"] but if we use a group in the regex we get only the group(s) (as a sub-array) content.scan /\n\0(\w+)/ => [["ab"], ["bc"]] So if all you need is to scan the names following \n\0\n\0 you are done, if you need the positions in the string it is a little bit more work. > -- > Posted via http://www.ruby-forum.com/. > > -- The 1,000,000th fibonacci number contains '42' 2039 times; that is almost 30 occurrences more than expected (208988 digits). N.B. The 42nd fibonacci number does not contain '1000000' that is almost the expected 3.0e-06 times.