[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: reg exp comparison hanging irb

Eric Hodel

12/27/2006 10:14:00 PM

On Dec 26, 2006, at 21:20, gaurav bagga wrote:

> hi,
>
> 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/ru...talk...
> read/thread/8f085b191387d799/e78a71cbd7354c0c#e78a71cbd7354c0c"=~r
>
> i'll appreciate if anyone helps with this.

There's already a library for what you want to do:

require 'uri'

uri = URI.parse "http://groups-beta.google.com/group/ru...
talk/..."

--
Eric Hodel - drbrain@segment7.net - http://blog.se...

I LIT YOUR GEM ON FIRE!