I’m struggling with regex. I can arrive at the number I need after two separate operations, but I’d like to make it into one operation. This is the string I’m trying to parse
{“transactionResponse”:{“responseCode”:“1”,“authCode”:“”,“avsResultCode”:“P”,“cvvResultCode”:“”,“cavvResultCode”:“”,“transId”:“ 60116040358 ”,“refTransID”:“”,“transHash”:“1C14D0053F4893C1B47CDFE7CD1D0FE1”,“testRequest”:“0”,“accountNumber”:“XXXX7890”,“accountType”:“eCheck”,“messages”:[{“code”:“1”,“description”:“This transaction has been approved.”}],“transHashSha2”:“”,“SupplementalDataQualificationIndicator”:0},“refId”:“27”,“messages”:{“resultCode”:“Ok”,“message”:[{“code”:“I00001”,“text”:“Successful.”}]}}
The number I need is in bold. So far to get there, I’m using
Step 1 = transId":“\d*
which yields = transId”:"60116040358
then
Step 2 = \d*
which yields the number I need.
I’m using regexr. I tried using the positive lookbehind (?<=transId":")\d* which worked on regex101.com, but not regexr. It’s not working in bubble either, so I figure regexr is what it should be based on.
If anyone can help me do it in one step, i’d appreciate it.
Use this string without the bold to test it:
{“transactionResponse”:{“responseCode”:“1”,“authCode”:“”,“avsResultCode”:“P”,“cvvResultCode”:“”,“cavvResultCode”:“”,“transId”:“60116040358”,“refTransID”:“”,“transHash”:“1C14D0053F4893C1B47CDFE7CD1D0FE1”,“testRequest”:“0”,“accountNumber”:“XXXX7890”,“accountType”:“eCheck”,“messages”:[{“code”:“1”,“description”:“This transaction has been approved.”}],“transHashSha2”:“”,“SupplementalDataQualificationIndicator”:0},“refId”:“27”,“messages”:{“resultCode”:“Ok”,“message”:[{“code”:“I00001”,“text”:“Successful.”}]}}
These are the screenshots of me testing it with regexr and regex101