I wrote a simple thing to collect most of the regexps defined in a module, to test them with ruby 3.2's `Regexp.linear_time?`. This could be useful for finding and preventing ReDoS vulnerabilities. In addition to consts it finds hard-coded regexp literals in method defs, even when dynamically defined with eval.
https://github.com/ruby/net-imap/blob/master/test/net/imap/regexp_collector.rb
https://github.com/ruby/net-imap/blob/master/test/net/imap/regexp_collector.rb
