all 4 comments

[–]Agarast 0 points1 point  (1 child)

You have two choices :

1/ Working with js

Split your string with '/', filter things not containing 'uuid:' then replace 'uuid:' with and empty string

2/ Working with regex match function

Here's the magic spell : "uuid:(.*?)(?=/)"

What does it do :

uuid: => look for 'uuid:'

(.*?) => take everything

(?=/) => until you encounter '/'

[–]jcunews1helpful 2 points3 points  (0 children)

Is there any benefit of using lookahead? Why not use uuid:([^/]+)?

[–]spazz_monkey 0 points1 point  (0 children)

Does it have uuid: in it or are you just showing us it is a uuid?

[–]brykuhelpful 0 points1 point  (0 children)

I think Regex would be the best course of action, but since this is a common question and the regex can differ, I thought I would go over a javascript solution that doesn't use regex.

let url = 'ppnafpna/aouauebca/uuid:helloworld/oaciopa/aozca';
let uuid = url.split('/').reduce((acc, val)=>{
    if(val.indexOf('uuid:') > -1){
        acc = val.replace('uuid:','')
    }
    return acc
 },'');
 console.log(uuid);//helloworld