Created
January 31, 2017 18:29
-
-
Save anonymous/e8a2939ddbbb0afcc8d6cd217f06be28 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
irb(main):093:0> supported_flags = ["-a","-b","-c","-d"] | |
=> ["-a", "-b", "-c", "-d"] | |
irb(main):094:0> flags_regex = Regexp.union(supported_flags.map{|i| Regexp.new("\\#{i}*")}) | |
=> /(?-mix:\-a*)|(?-mix:\-b*)|(?-mix:\-c*)|(?-mix:\-d*)/ | |
irb(main):095:0> "-L".match(flags_regex) | |
=> #<MatchData "-"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment