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

How to capture particular value from Method's return value by using regex?

ruchitat
Inactive

Hi,

We need to capture particular value from method's return value as mentioned into attachment by using regular expression.Kindly help us to resolve this issue.

Thanks & Regards,

Ruchita Terse

internal-server-error.png

6 REPLIES 6

Kodai_Ishikawa
Dynatrace Helper
Dynatrace Helper

Hi Ruchita,

I would be happy help you with creating a regex. Are you able to directly copy and paste the full string onto this thread so I can use it to test against it?

Regards,

Kodai

Hi Kodai,

PF required information below :

{"head":{"status":"Failed","errors":[{"code":"SOA_EX","msg":"Internal server error from NSDL Service i.e. status is not 1","thrownat":"CommonValidations_javaImplImpl.java, validatepan, 89"}],"userid":"xxxx"

From this we need to capture this value - "Internal server error from NSDL Service i.e. status is not 1"

Thanks ,

Ruchita Terse

please try

{"head":{"status":"Failed","errors":\[{"code":"[^"]*","msg":"([^"]*)

Hi Ruchita, If the returned JSON text does not contains more than one msg fields you can use:

To Match the text:

.*?"msg":"(?:[^"]+)".*

To Capture the text:

.*?"msg":"([^"]*)".*

Let me know if it helps.

Regards, Rajesh

Pl. Marks as best, if it had helped 😉

ruchitat
Inactive

Hi,

Thanks all for your reply.

Kindly help us to resolve below mentioned issue.

We need to capture particular value (only numeric value) from method's argument value as mentioned into attachment by using regular expression.

appno.png/TEBT_ApplicationModuleWeb/ApplicationSubmissionHTTPExport/submitApplication;{"head":{"txnid":"POS-xxxxxxxxxx-xxxxx","userid":"xxxxxx","source":"POS"},"body":{"applctndetails":{"basicappinfo":{"chnlnm":"Agency","appno":"11000xxxxxxxx","appmode":"xxxxxxx","chnlpartner":"xxxxxx","instype":"xxxxxx",

Thanks & Regards,

Ruchita Terse.