# Need Help with String Extraction in DPL

**URL:** <https://community.dynatrace.com/t/need-help-with-string-extraction-in-dpl/52144>\
**Category:** DQL\
**Tags:** dpl\
**Created:** [June 17, 2025, 10:44pm UTC](https://community.dynatrace.com/t/need-help-with-string-extraction-in-dpl/52144 "2025-06-17T22:44:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akhil-Jayendran](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/akhil-jayendran/32/153_2.png) [@Akhil-Jayendran](https://community.dynatrace.com/u/Akhil-Jayendran)\
**Post date:** [June 17, 2025, 10:44pm UTC](https://community.dynatrace.com/t/need-help-with-string-extraction-in-dpl/52144/1 "2025-06-17T22:44:15Z")

</div>

Hello Team,I would like to extract only values matching the pattern \*appdevgw-\*\*\*&nbsp; from below sample logs&nbsp; data and assign them to a new field named HostName with capital letters, for example: HostName=DAPPDEVGW-001. Is that possible using DPL ?

DATA record(host.name=“[dappdevgw-001.phx.ad.company.com](http://dappdevgw-001.phx.ad.company.com)”, message= “this is a test message 1”),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; record(host.name=“[pappdevgw-006.phx.ad.company.com](http://pappdevgw-006.phx.ad.company.com)”, message= “this is a test message 2”),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; record(host.name=“[bappdevgw-007.phx.ad.company.com](http://bappdevgw-007.phx.ad.company.com)”, message= “this is a test message 3”)Br,

---

<div class="post-metadata">

**Author:** ![Akhil-Jayendran](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/akhil-jayendran/32/153_2.png) [@Akhil-Jayendran](https://community.dynatrace.com/u/Akhil-Jayendran)\
**Post date:** [June 18, 2025, 1:36am UTC](https://community.dynatrace.com/t/need-help-with-string-extraction-in-dpl/52144/2 "2025-06-18T01:36:21Z")

</div>

I think I found it in a different way. without DPL.

DATA record(host.name=“[dappdevgw-001.phx.ad.company.com](http://dappdevgw-001.phx.ad.company.com)”, message= “this is a test message 1”),  
record(host.name=“[pappdevgw-006.phx.ad.company.com](http://pappdevgw-006.phx.ad.company.com)”, message= “this is a test message 2”),  
record(host.name=“[bappdevgw-007.phx.ad.company.com](http://bappdevgw-007.phx.ad.company.com)”, message= “this is a test message 3”)  
| fieldsAdd HostName = splitString(host.name, “.”)  
| fieldsAdd HostName =arrayFirst(HostName)  
| fieldsAdd HostName= upper(HostName)

But&nbsp;I’m curious — is this possible with DPL?

---

<div class="post-metadata">

**Author:** ![jmarbaix](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jmarbaix](https://community.dynatrace.com/u/jmarbaix)\
**Post date:** [June 18, 2025, 8:43am UTC](https://community.dynatrace.com/t/need-help-with-string-extraction-in-dpl/52144/3 "2025-06-18T08:43:31Z")

</div>

DPL is only for extraction, not for adapting the string itself. You need to compare it to regular expressions. This means that if you want to do more than just matching/searching and extracting a string, you will need a DQL statement.

A solution with DPL could be:

```auto
DATA record(host.name="dappdevgw-001.phx.ad.company.com", message= "this is a test message 1"),
record(host.name="pappdevgw-006.phx.ad.company.com", message= "this is a test message 2"),
record(host.name="bappdevgw-007.phx.ad.company.com", message= "this is a test message 3")
| parse `host.name`, """DATA?
(DATA{1}
'appdevgw-'
DATA{3}):HostName
DATA"""
| fieldsAdd HostName = upper(HostName)

```
