Last active
August 29, 2015 14:11
-
-
Save ieda/ddd14ae9d770745a7b23 to your computer and use it in GitHub Desktop.
(idea) Ruby Helper to build Regexp string
This file contains hidden or 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
RegexpBuilder.new.build({ | |
ignore_case: true, | |
begin_with: "A", | |
contains: [ | |
# order sensible | |
[:contains, "B"], | |
[:any], | |
[:contains_any, "D", "E"], | |
] | |
end_with: "C", | |
}) | |
# => /^AB+.*[DE]+C$/i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment