Replace number with generic string

Hi,

How can I replace a numeric (or other pattern) string with a generic one? For example, my DQL query returns:

/v1/shipments/customer-picked-up
/v1/shipments/containers/100000011782/hold-locations
/v1/shipments/2023051723300410000038807/assigned-user

But I’d like to format them into something like this:

/v1/shipments/customer-picked-up
/v1/shipments/containers/[n]/hold-locations
/v1/shipments/[n]/assigned-user

Thanks!

Hi @educampver ,

you can use the parse command to extract the part before and after the pattern, and append to join the parts, including a replacement string:

data record(a="/v1/shipments/customer-picked-up"), record(a="/v1/shipments/containers/100000011782/hold-locations"), record(a="/v1/shipments/2023051723300410000038807/assigned-user")<br>| parse a, "'/v1/' LD:b int LD:c"<br>| fields result = if(isNull(b), a, else:concat(b,"[n]",c))