Skip to content

Instantly share code, notes, and snippets.

@joshuakemmerling
Last active May 25, 2018 12:49
Show Gist options
  • Save joshuakemmerling/fbcb7ba290b6087d776e to your computer and use it in GitHub Desktop.
Save joshuakemmerling/fbcb7ba290b6087d776e to your computer and use it in GitHub Desktop.
Filter list of dynamic URLs.

Steps

1. Get incoming URL

var url = '/product/shoes/234'

2. Create regex from incoming URL

var regex = '/(product|:[a-zA-Z0-9]+)/(shoes|:[a-zA-Z0-9]+)/(234|:[a-zA-Z0-9+)'

3. Convert URL to dynamic parameters

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