How do I get the last values of a string using the parse command?

Hi,

I’m having trouble understanding the DPL documentation. What I want to do is extract the last characters after a certain character, in this case it would be ‘/’. I am trying to extract just the filename from the string. For example,

I would just want input.csv from the following filepath/string:

/NODEA12XY/data/services/svc_rt/module/xxabc/3.4.7/in/input.csv

Hi @badgerfifteen

You can achieve this with the “substring” and “lastindexof” function, String functions — Dynatrace Docs , String functions — Dynatrace Docs

data record(content = "/NODEA12XY/data/services/svc_rt/module/xxabc/3.4.7/in/input.csv"),
     record(content = "/NODEA12XY/data/services/input2.csv"),
     record(content = "/NODEA12XY/input3.csv")
| fieldsAdd FileName = substring(content, from:lastIndexOf(content, "/") + 1)

Try and let us know.