From: Andreas Hansen Date: 2009-06-25T23:39:53+09:00 Subject: Re: regex that works on rubular.com but not in my program its the first time me or my friend has worked with regex, my friend have rewritten the regex a bit, maybe it makes more sense now: (?#start: fetch the ip adress after IP) IP\s((?:\d*\.) {3}\d{1,3}) (?#end: fetch ip) (?#start: flag).*:\s([PSF])(?#end:flag) (?#nothing more interesting on this line) .*$(?#end) (?#start: look for index pattern) \s^E.{5}@.{9}Q.{30,42} (?#end: index) (?#start: get the username which is surrounded by multiple dots, minimum of 2 in the begining and 0+ after) .*\.{2,}([\w](?:\w+.){1,13}\w)\.* (?#end: username) Each of those expressions works individually and together(in rubular) but when i combine them in my program it prints nothing, not even nil. So i tried them individually in the program as well and all but the index pattern(prints nothing) works. so if anyone could offer some insight why its not working or knows a better way to do this we卒ll be very happy:) another thing: some usernames are really hard to extract from the packets. an example: G-eX.Dowden(http://rubular.com/regexes/8401) any suggestions? File.foreach filename do |line| b = line.scan rx puts b.length end was a nice solution, thank you:) -- Posted via http://www.ruby-forum.com/.