Customize request naming with regex extraction rule

Hi all,

Need to create a global request naming rule which will extract everything before the last / and then append <ID> to the resulting name. Having trouble creating a regex pattern that does not break DT’s rules (it’s either greedy or too expensive). Could someone help out with this one?

Input examples:

/URI-A/URI-B/URI-C/URI-D/04w0da444d979e74GSDFGS92f75e0d1e187f9?timestamp=1234
/URI-A/URI-B/URI-C/04w0da444d979e74GSDFGS92f75e0d1e187f9?timestamp=1234

Regex Extraction > everything before the last /= {Cleaned-Placeholder}

/URI-A/URI-B/URI-C/URI-D/
/URI-A/URI-B/URI-C/​

Request naming rule = {Cleaned-Placeholder}/<ID>

/URI-A/URI-B/URI-C/URI-D/<ID>
/URI-A/URI-B/URI-C/<ID>

Hope that one of these two options help

1st option:

2nd option:

Unfortunately, both are invalid options - the second one is greedy and has multiple capture groups which are some of the DT regex restrictions :disappointed_face:

Hello @diana

Please try the following:

(?>.+\/)

Regards,

Babar

Hey @Babar_Qayyum , it doesn’t like that one either.

Hello @diana

Please try the following.

(\DURI\D+\W+)

Regards,

Babar

Hi Diana,

Try this one…

(.*?\/)[^\/]++\/?$

It will extract everything up to and including the final “/” of the URL, and it will be accepted by Dynatrace regex for request naming rules.

Best regards,

Radu

Hi Radu,

That one is also not accepted:

Sorry, forgot to add the ^ at the beginning:

^(.*?\/)[^\/]++\/?$

Awesome, that works! Thanks Radu :blush: