cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

RegEx Required

Babar_Qayyum
DynaMight Leader
DynaMight Leader

Dear All,

We need a RegEx to capture the red Rectangle values.

Regards,

Babar


10 REPLIES 10

gabriel_casella
Dynatrace Pro
Dynatrace Pro

What have you tried already that didn't work or partially worked?


Hello @Gabriel C.

Let me confess that I am not good in the RegEx, therefore, I was totally not able to create a desire RegEx.

Regards,

Babar


No worries Babar. The simple Regexes are not that hard. I strongly suggest that you try to learn it and why not use this opportunity for it? If you want, here are some links that you can start to take a look at:

  1. https://www.regular-expressions.info/quickstart.html
  2. https://en.wikipedia.org/wiki/Regular_expression#Basic_concepts

As they are very versatile they will help you in other situations too (not only on Dynatrace context).

While that happens, I may try to do it for you, but I need the text of the image as plain text to be able to do some testing (I personally use the website https://regex101.com/).

Regards,

PS.: Even if you tried some regex that didn't work at all, it's good to know what you did as we see that you tried and may help you on the right track.


Hello @Gabriel C.

Thank you for sharing a valuable links and encouraging me to learn by myself.

Would you mind to provide me your personal email address where I can share the text with you.

I tried the below RegEx to find both groups but not sure how much will be expensive.

(\d00010)?(\d000)?

Regards,

Babar


rswarnka
Helper

Try this:

<Requestor_Channel_Function>(.\*?)</Requestor_Channel_Function>.\*<ASI_Return_Code>(.*?)</ASI_Return_Code>

Regards, Rajesh


Hello @Rajesh S.

I need to capture a specific Requestor_Channel_Function and ASI_Return_Code because there are many different functions and return codes.

Regards,

Babar


The above regex will only capture that only. Also, I hope the tags (Requestor_Channel_Function> & <ASI_Return_Code>) are not repeating in return text. . If yes, then appmon will capture the very first ones.


Hello @Rajesh S.

In the same call Requestor_Channel_Function calls many times with the different numbers and also in the case of unsuccessful attempt the return code will be different.

Regards,

Babar


In case of no match it will be 'null', afaik in appmon? I am right?

Also, catching the specific/arbitrary occurrence may be possible however that will make Regex complex and bulky. You need to watchout all possible return values and then create an expression.

I have faced a situation of repeated sub text like yours, but however I was lucky to grab the very first tag or the tag next to unique tag.


Hi Rajesh/Babar,

I guess that when part of the regex does not match/find a value, a blank will be returned, not a 'null'.

Also, depending on how you want to report the data, you want to create two metrics, one with each part of the regex above. One for

<Requestor_Channel_Function>(.*?)</Requestor_Channel_Function>

And another for

<ASI_Return_Code>(.*?)</ASI_Return_Code>

Tks all,