From: Ben Tilly Date: 2001-02-24T03:28:00+09:00 Subject: [ruby-talk:11400] Suggestion: Slow RE mode I would like to see an optional way to force all RE matches to fail before they succeed. This seems like an absurd request, but bear with me. It is easy to write an RE that looks like, say, /^(\s*yada\s*)*$/ which will match very quickly if it can match, but take seemingly forever to fail. Auditing code to verify that it has no dangerous REs is very difficult. However this is exactly the kind of mistake you would like to be able to test for. So the idea would be that whenever you compile an RE you would compile 2 of them. The first is guaranteed to fail, and is run just to show you how slow the failure mode of the RE is. The second is the original RE. So in the slow mode you would first run: /^(\s*yada\s*)*$(?:(?!a)a)/ and deliberately not set $~, $`, etc, and then you would try normally with: /^(\s*yada\s*)*$/ Routinely try the slow mode in your testing suites, and you can have some confidence that your program does not have a disasterous RE waiting to trip you up. Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com