Last active
August 29, 2015 14:06
-
-
Save jasonm23/772423e7b5dae15ffd19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = ["searching for terms", "terms to search for", "search string contains", "terms", "kippers"] | |
words = "search term" | |
list.select{|s| | |
s.match Regexp.new("#{words.join('.*')}.*") or | |
s.match Regexp.new("#{words.reverse.join('.*')}.*") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment