# Parsing URL to extract data

**URL:** <https://community.dynatrace.com/t/parsing-url-to-extract-data/56050>\
**Category:** DQL\
**Tags:** dql, dpl\
**Created:** [June 1, 2026, 1:18pm UTC](https://community.dynatrace.com/t/parsing-url-to-extract-data/56050 "2026-06-01T13:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apourbaix](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@apourbaix](https://community.dynatrace.com/u/apourbaix)\
**Post date:** [June 1, 2026, 1:18pm UTC](https://community.dynatrace.com/t/parsing-url-to-extract-data/56050/1 "2026-06-01T13:18:46Z")

</div>

In DQL, I’m trying to parse an url to extract usefull data.

Example:&nbsp;[https://api-services.unknown.com/env/v6/permissions/check](https://api-services.unknown.com/env/v6/permissions/check)

I want to extract api version which is v6 in this case. Then, I want all the following, which would be&nbsp;[/permissions/check](https://api-services.unknown.com/env/v6/permissions/check)

Both data would be in separate fields.

I have tried a lot things with parse but never managed to do it, whether it would be simple with a classic regexp.

I have read DPL Grammar documentation as well as DPL Lines and Strings, but I don’t understand how to build the parse command for my need.

Right now, I am using this:&nbsp;| fieldsAdd relativePath = substring(requestUrl, from: indexOf(requestUrl, “/”, from: 8))

It isn’t very good, but it is still better than the full url !

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [June 1, 2026, 1:59pm UTC](https://community.dynatrace.com/t/parsing-url-to-extract-data/56050/2 "2026-06-01T13:59:16Z")

</div>

With parsing command would be something like this:

```markup
data record (a = "https://api-services.unknown.com/env/v6/permissions/check")
| parse a, "LD 'env/' LD:apiversion '/' LD:rest "

```

See if helps

---

<div class="post-metadata">

**Author:** ![apourbaix](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@apourbaix](https://community.dynatrace.com/u/apourbaix)\
**Post date:** [June 1, 2026, 2:14pm UTC](https://community.dynatrace.com/t/parsing-url-to-extract-data/56050/3 "2026-06-01T14:14:53Z")

</div>

_env_ text is an example, it could be anything else.

I just tried try this:

**| parse requestUrl, “LD ‘/v’ INT:versionNum ‘/’ DATA:apiPath”**  
**| fieldsAdd apiVersion = concat(“v”, toString(versionNum))**  
**| fieldsAdd apiEndpoint = concat(“/”, apiPath)**

So far, it seems to work fine.
