Skip to content

Instantly share code, notes, and snippets.

@ieda
Last active August 29, 2015 14:11
Show Gist options
  • Save ieda/ddd14ae9d770745a7b23 to your computer and use it in GitHub Desktop.
Save ieda/ddd14ae9d770745a7b23 to your computer and use it in GitHub Desktop.
(idea) Ruby Helper to build Regexp string
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