I’ve got a strange feeling that this is one of those little bits of
knowledge known to everybody except people who think they know
something about regular expressions knows… but here goes:
I have a regular expression and a string which cause Ruby to hang.
Try this:
src=’<hosted class=“com.firsthop.mg.gui.Servlet” product=“TestSuite"
classpath’
src =~ /^<((?:[\w:][-\w\d.]:)?[\w:][-\w\d.])\s*(((([”’]).?\5)|[^/’">])*?)(/)?>/mu
Notice that there’s a CR between %q{“TestSuite”} and %q{classpath}.
This hangs on at least Ruby 1.6.5 and 1.6.7 – one of those 100% CPU,
never return hangs.
Is this a known problem with Ruby, or should I file a bug report?
I’ve checked this in Perl; it doesn’t match, of course, but neither
does it hang.