From: Dave Thomas Date: 2001-07-21T07:11:34+09:00 Subject: [ruby-talk:18201] Re: Pattern Matching takes all Resources Stefan Mueller writes: > I'm having some big problems with Pattern Matching of Regex. > The example blocks everything in the main thread, for quite a while. You have got one of those Regexps that operate in exponential time because of all the '*'s and the backtracking they cause. I strongly recommend Friedl's book on regular expressions which covers these. Anyway, > aString = '' > aRegEx = /<(\w*|\s*|\d*|[%=:".,\/?!\-_#]*)*>/ > Thread.new { aString =~ aRegEx } Isn't this equivalent to: aString = '' aRegEx = /<([\w\s\d%=:".,\/?!\-_#]*)>/ aString =~ aRegEx This comes back in milliseconds on my box. Regards Dave