weavejester/re-rand — pull request #3 by marhel (2013-09-13 08:31:12+00:00)
Title: Added support for OR (pipe)

Added support for alternatives in the expression, such as;

user=> (re-rand #"(555|1-800)-(\d{3} \d{3}|[A-Z]+)|unlisted")
["555-654 606" "555" "654 606"]
user=> (re-rand #"(555|1-800)-(\d{3} \d{3}|[A-Z]+)|unlisted")
"unlisted"
user=> (re-rand #"(555|1-800)-(\d{3} \d{3}|[A-Z]+)|unlisted")
["1-800-054 837" "1-800" "054 837"]
user=> (re-rand #"(555|1-800)-(\d{3} \d{3}|[A-Z]+)|unlisted")
["555-DJE" "555" "DJE"]
user=> (re-rand #"(555|1-800)-(\d{3} \d{3}|[A-Z]+)|unlisted")
["1-800-ARDB" "1-800" "ARDB"]

Modified `series` to allow it to continue matching against an empty string (or rather, until some rule returns nil), as the `pattern` rule now ends with `many` that may successfully match zero times against the empty string (i.e. when alternatives are not used in the pattern).

Closes #2.