From: Wes Gamble Date: 2006-05-25T00:03:56+09:00 Subject: Re: String.scan hangs in some cases? Bill Kelly wrote: > From: "Robert Klemme" >> >> Yes, that's a property of NFA based regular expression engines. Some >> patterns have awful runtime characteristics because of the >> backtracking. Without looking too close at your patter I guess in >> this case it's caused by having "x*" twice in your RX - not very >> useful anyway. > > Thanks :) We haven't seen the OP's regexp yet; I was just > offering the above as an example of what can cause the > hanging he described. > > > Regards, > > Bill All, Thanks for giving me some idea of what might be wrong. For now, I've gone with a simpler regex that I think will work fine. My original pattern was attempting to allow several portions of the pattern to be optional and the more that I think about it, the more it makes sense that this might occur. I will keep (?>pattern) in mind as a way to inhibit backtracking. Thanks, Wes -- Posted via http://www.ruby-forum.com/.