From: Andreas Hansen Date: 2009-06-25T18:26:11+09:00 Subject: regex that works on rubular.com but not in my program hi, i have some trouble with a regex. it works on rubular.com but not in my program ive used the content in testfile.txt on rubular.com the regex finds a ip-address, a flag and a username in a TCP-packet(an example: http://rubular.com/regexes/8389) regex = /(?:[I][P]\s)((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:\d{1,3}\.){3}\d{1,3}).{0,}(?:[:][\s])([P])(?:.{0,})$\s(?:^[E].{5}[@].{9}[Q])(?:.{30,42}\.)\W{0,}([\w\d]{1}(?:[\w\d-]+.){1,13}[\wA-Z0-9])/i filename = 'testfile.txt' file = File.open(filename).collect j = file.length i = 0 while i< j a = file[i].to_s b = a.scan(regex) print b.length i = i + 1 end -- Posted via http://www.ruby-forum.com/.