From: Simon Strandgaard Date: 2006-12-27T17:29:16+09:00 Subject: Re: reg exp comparison hanging irb On 12/27/06, gaurav bagga wrote: > was just going trough reg exp > the lines below just hangs irb and cpu usage goes 100% on windows xp > can anyone explain me why? > > > irb(main):001:0> r=/^(https?:\/\/)?[a-z0-9]+([\.\-\_=&\+\/\?]?[a-z0-9]+)+$/i > => /^(https?:\/\/)?[a-z0-9]+([\.\-\_=&\+\/\?]?[a-z0-9]+)+$/i > irb(main):002:0> " > http://groups-beta.google.com/group/rubyonrails-talk/browse_th > read/thread/8f085b191387d799/e78a71cbd7354c0c#e78a71cbd7354c0c"=~r the GNU regexp engine has a few oddities.. here is another example that triggers an endless loop. r='' r.scan /<(?:[^">]+|"[^"]*")+>/ we have in common that our regexp has nested repeating patterns. -- Simon Strandgaard http://opcoders.com/