Stefan Mueller <flcl / gmx.net> 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 = '<img src="http://www.url.com/file.gif"</b>'
> aRegEx =  /<(\w*|\s*|\d*|[%=:".,\/?!\-_#]*)*>/	
> Thread.new { aString =~ aRegEx }			

Isn't this equivalent to:

  aString = '<img src="http://www.url.com/file.gif"</b>'
  aRegEx =  /<([\w\s\d%=:".,\/?!\-_#]*)>/			
  aString =~ aRegEx

This comes back in milliseconds on my box.


Regards


Dave