Skip to content

Instantly share code, notes, and snippets.

@rex
Last active December 30, 2015 21:39
Show Gist options
  • Select an option

  • Save rex/7888464 to your computer and use it in GitHub Desktop.

Select an option

Save rex/7888464 to your computer and use it in GitHub Desktop.
Randexp Regex generators
require 'randexp'
#
# String of comma-separated values
#
/(\w{4,10}, ){2,6}\w{4,10}/.gen
# => "colport, antidrag, bahur, fatly"
# => "peak, prudential, pyke, Squaxon, oleous"
# => "postmortal, wormweed, repassable"
# => "idealness, motey, betwattled, jobman, nonpaying, sarcolyte"
#
# 7digital Artist Image URL
#
/http:\/\/cdn.7static.com\/static\/images\/artistimages\/\d{2,4}\/\d{2,4}\/\d{2,4}\/0{4,7}\d{0,5}_<\$size\$>.jpg/.gen
#
# 7digital Release Image URL
#
/http:\/\/cdn.7static.com\/static\/img\/sleeveart\/\d{2,4}\/\d{2,4}\/\d{2,4}\/0{4,7}\d{0,5}_<\$/.gen
# => "http://cdn.7static.com/static/images/artistimages/5909/041/05/00000003_<$size$>.jpg"
# => "http://cdn.7static.com/static/images/artistimages/17/17/80/0000055337_<$size$>.jpg"
# => "http://cdn.7static.com/static/images/artistimages/803/69/4382/00006_<$size$>.jpg"
#
# 7digital Artist URL
#
/http:\/\/www.7digital.com\/artists\/[:last_name:]/.gen
#
# 7digital Release URL
#
/http:\/\/www.7digital.com\/artists\/[:last_name:]\/\w{2,20}/.gen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment