Skip to content

Instantly share code, notes, and snippets.

@ml242
Created April 23, 2015 23:08
Show Gist options
  • Save ml242/3d2f632dadfa7330326e to your computer and use it in GitHub Desktop.
Save ml242/3d2f632dadfa7330326e to your computer and use it in GitHub Desktop.
[
"5 Days With 5 Scholars: History, NAS, Marine Resources, US Constitution, and Hum",
"Across the Dakotas: Adventure Along the Missouri River",
"Alaska Up and Down: From the Arctic Coast to the North Pacific Fjords",
"Another Day, Another Scholar",
"America''s Musical Theater/Astronomy/History of Lake Arrowhead",
"Wolf: An In-Depth Study/Introduction to Astronomy/Walk in the Clouds: View of Li",
"W.E.B. Dubois and the Black Experience",
"Different View of Santa Fe: A Vantage Point That Will Surprise You!",
"The Grand Canyon: Natural & Human History & the Historic Grand Canyon Railway",
"Advanced Watercolor Painting - \"People - Up-Close Studies\"",
"Porcelain, Stoneware, and Earthenware; Pottery Old and New",
"Oregon Shakespeare Festival/Is Caesar an Honorable Man?/Mystics in Religious Tra",
"Tell Me Your Story (With Veterans History Project) at Good Samaritan Loveland Vi",
"Seldom Seen Spaces At the University of Pittsburgh (Active)",
"Philadelphia’s African American Roots: History, Culture, Music, Arts",
"Volunteering at Monument Valley High School: Grades 7 – 12",
"Wisdom Of Our Fathers @ ACTS Retirement-Life Communities, Inc. Southampton Estat",
"Art + Nature: Landscape Painting In Maine",
"From “Silent Spring” to “An Inconvenient Truth”",
"What Makes a “Great President?” Music of the 1940s, Legacy of a Nation 1940—1946",
"Keep ‘Em Laughing: Exceptional Comedy",
"A Voyage Crossing 70º of Latitude: From Chile to Western Africa",
"A “Perfection of Landscape”: Two Centuries of Artists at Yellow Springs",
"Preserving Museum Treasures at the Mütter Museum",
"The Journey Through Hallowed Groundâ„¢: The Place Where America Happened",
"Great Composers: Mahler, Prokofiev, Shostakovich, and Bartók",
"Bohème and Traviata: Two Girls, Two Worlds, One Fate, Verdi’s Rigoletto, and Gio",
"The Galápagos Islands By Land and By Sea",
"A Conversation Café",
"Intergenerational in the City of Light: À la Découverte de Paris (age 10-13)",
"Cross-Country Skiing in Beautiful Rural Vermont…Plus!",
"Walk Back in Time: Hiking to Châteaux, Vineyards and Prehistoric Caves of the Lo",
"John Marshall and the Supreme Court, La Belle Époque in Richmond, Highlights of",
"Christmas in France: Joyeux Noël",
"Andalusia to Barcelona: Flamenco, Tapas, Palaces and Gaudí",
"Aventure en Famille à Paris: Three Generations Discover the City of Lights",
"Intergenerational: ¿Qué tal, Barcelona?",
"Day of Discovery with the Metropolitan Opera – Carmen and Così fan tutte",
"Fête de Noël: Christmas in Québec City",
"Iguaçu Falls to Victoria Falls: Crossing the Atlantic from Cape Horn to the Cape",
"Descriptive Astronomy the Heavens Are Telling\Descriptive Astronomy the Heavens",
"Independent Nice: Exploring the Heart of the Côte d''Azur",
"The Best of Barcelona and Madrid With Your Family: Flamenco, Fútbol & Fun for Al",
"Playing With Shakespeare: Two Weeks At the Oregon Shakespeare Festival #1",
"Wine and Food for the Casual Connoisseur: The EPCOT® Food and Wine Festival"
]
@ml242
Copy link
Author

ml242 commented Apr 23, 2015

It should remove all punctuations
It should replace & with and
It should join all words with a -
It should leave accented characters
Example of passing slugs:

Christmas-in-France-Joyeux-Noël
Intergenerational-Qué-tal-Barcelona
Advanced-Watercolor-Painting-People-Up-Close-Studies
The-Grand Canyon-Natural-and-Human-History-and-the-Historic-Grand-Canyon-Railway

@ml242
Copy link
Author

ml242 commented Apr 23, 2015

/.+://.+/.+v?=(\w+)/

/ ~ like "" for string, [] for arrays, // is for regex
.+ ~ 1 or more characters (the plus grabs all single characters, * is 0 or more, + is the first)
:// ~ 1 colon & 2 forward slashes
.+ ~ 1 or more characters
/ ~ 1 forward slash
.+v?= ~ 1 or more chars, opt. with a leading 'v' & '=' char
(\w+) ~ group capture 1 or more alphanumeric characters, the parentheses make the capture happen.
/ ~ ends the reg ex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment