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

Help in regex to mark user errors as invalid

gilgi
Pro

Hi All, 

 

I need your wisdom in regular expressions and Dynatrace:

We have a situation in which an application is calling a third party, receiving all responses as 200 OK, but in a numeric field there could be different values to mark the completion status of the request. Unfortunately, there are several values that can mark it as succeeded and several to mark it as failed. We want to try and create a request attribute that will show us whether something have failed. Unfortunately, we only know which values are successful, and these are 0 and 9007 (Don't ask me about this choice of values please).

 

I've been trying to play with further processing of the RA in order to indentify those with different values, but the 9007 is failing me over and over again.

 

Is this doable at all? Can you assist?

 

Gil.

4 REPLIES 4

ChadTurner
DynaMight Guru
DynaMight Guru

At this point in time I don't think it is. I can see the Response Code under the Purepath Metadata, but within the Request Attribute settings, I don't see where we can isolate that and use it as a Request Attribute. 

 

You would need to put in a RFE to possibly gain this feature in the product. 

-Chad

gilgi
Pro

Hi @ChadTurner ,

 

I must have mis-explained myself. 

I'm not interested in the http response code, but in a parameter value that is returned from a function. I am able to collect this "raw" code.

The challenge here is that it can have different values that are expressing "good" execution and multiple values that express "failed" executions. I'm trying to find a regex that will set a request attribute to mark the failure if the value is not equal to one of several values. problem is that the values are numbers, some of them are with multiple digits (for example two valid codes are 0 and 9007).

 

Hope this is better understood. 

DavorinKrivak
Helper

Hi @gilgi ,

 

Try using negative lookahead (https://www.regular-expressions.info/lookaround.html). Something like this should work (I've only tested it in the UI):

^(?!^9007$|^0$)\d*+$

So here we're basically telling the engine to parse any digit(s) that are not 9007 or 0. Also, be sure to prune whitespaces with this one.

 

 

Try this one too and let’s see the outcome.

 

(^(?!(?!^9007$|^0$)))

 

i.e., strictly starting with “9007” or “0” in the response with space insensitive.