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

regex to extract substring from the string

cp_patel
Participant

I have a request attribute which returns me a value as a long string.

For example :

xxxxxx|PRTL4797897|RHMP8453|442275|6610.00|HMP|428094|03|INR|VDDIRECT|05-NA|NA|00000000.00|24-01-2020 16:36:12|0300|NA|3308031910026362|NA|NA|NA|NA|NA|PAYMODE|NA|PGS10001-Success|1175508963

I only want extract the value which is bold and underlined(6610.00), which indicated the amount paid by end users to customer and finally want to do sum of all the extracted values to show the final premium received by customer in a dashboard in a day. Can anyone help with regex which I can apply here, Further restrict or process captured parameters section of request attribute. The settings of request attribute is attached here which returns me a text data as a return value of some java method.




5 REPLIES 5

thomas_brandl
Dynatrace Participant
Dynatrace Participant

Hi Chandni,


you can set this up in the "Further restrict or process captured parameters (optional)" section of the request attribute:


Hope this helps!


Thomas


And here is some quick and dirty regex you could try.


(\d+?\.\d+?)\|HMP\|


br,

Janne

Best solution)

Dallas
Dynatrace Mentor
Dynatrace Mentor

Hi Chandni,

I spent some time looking through this and it is quite difficult to only obtain the single value you are looking for without being able to use quantifiers inside of a groups.

Basically I was able to split the string into multiple values using step 2 of the process, but was not able to get it down to the single value. Here it retrieves two separate values. One containing your desired output and another that I cannot find out how to get rid of.

Since I do not know much about the data I am unsure if the |HMP value may change depending on the query. If not you could use:


Hope this at least helps you get started.

Thanks

-Dallas

thomas_brandl
Dynatrace Participant
Dynatrace Participant

Hi,


one more thing - from the data, my assumption is, that this is Bloomberg Format. Be aware that Bloomberg usually sends a header first, that explains what fields are sent (between START-OF-FIELDS and END-OF-FIELDS - see https://docs.informatica.com/data-integration/b2b-data-transformation/10-0/libraries-guide/descripti... )


If you know that the application is always requesting the same set of fields, you can of course just use a regex to select the n-th value, in your case:

[^\|]++\|[^\|]++\|[^\|]++\|[^\|]++\|[^\|]++\|([^\|]++\|)


(I couldn't find a quick simpler solution, as Dynatrace doesn't allow for quantified groups)


Thomas

Featured Posts