[ACCEPTED]-How to extract UUID from a uri using Regular Expression in Javascript?-regex
Accepted answer
/((\w{4,12}-?)){5}/.exec(URL)[0]
0
var url = 'http://apistaging.yoolk.com/listings/F7B519E8-135C-43D0-A35F-764B582EDC48?domain_name=cambodiastaging.yoolk.com&display=basi',
matches = url.match(/listings\/([A-F\d-]+)\?/),
UUID = matches[1];
console.log(UUID); // F7B519E8-135C-43D0-A35F-764B582EDC48
0
I would do it with splits.
var uri = 'http://apistaging.yoolk.com/listings/F7B519E8-135C-43D0-A35F-764B582EDC48?domain_name=cambodiastaging.yoolk.com&display=basic'
uri.split('?')[0].split('/')[4]
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.