I am looking for an existing Ruby library equivalent to Regexp::Assemble and Regexp::Trie for Perl and regexp-opt with Emacs.RubyGems if possible.
What you want is a method of creating a compact regular expression (string) that matches one of the many strings.For example, if "who"
"where"
"when"
is given three strings, you expect results like "(?:wh(?:e(?:n|re)|o))"
instead of "who|when"
.
Also, this is a question that you would like to know if there is an existing one, not the purpose of making it.So, just in case, the answers that show the code example that works above are contrary to the question's intentions.
ruby regular-expression rubygems
regexp_tree has been registered with RubyGems as per the comment to the question.Close the question
© 2024 OneMinuteCode. All rights reserved.