Created
December 27, 2018 11:39
-
-
Save franklinjavier/ac041673490dd3e26b469ae9738c1db8 to your computer and use it in GitHub Desktop.
Regex to get cloudinary transformation from URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = 'https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:eco,w_1800,c_limit/e_trim/v1/imagens/5/good-girl-carolina-herrera-eau-de-parfum-perfume-feminino-80ml-38271-1371676352244596349.jpg' | |
const transformationRE = /(\/(upload|fetch)\/)(.+?)(\/v\d+)/g | |
const [,,, transformation] = transformationRE.exec(url) | |
console.log(transformation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment