Home > other >  Extract value from websocket response
Extract value from websocket response

Time:09-13

Im getting this response from a websocket

a["MESSAGE\ndestination:/user/p0000450/queue/bets/place/status\ncontent-type:application/json\nsubscription:/queue/bets/place/status-1\nmessage-id:p0000450-79\ncontent-length:139\n\n{"id":"c00656b318","groupId":"113686950","status":"PLACED","code":"0","message":"BetSlip with No.113686950 has been accepted","context":{}}\u0000"]

I would like to extract the betslip no. Cant seem to generate regex that will extract this? please assist

i am planning to use regex extractor and beanshell postprocessor to save the data to excel for all responses

CodePudding user response:

From the provided info it's hard to figure out all the possible formats of the "betslip number", but try this:

\bBetSlip with No\.\s*(\d )\b

It captures any number of digits before the "BetSlip with No."-string.

Demo: enter image description here

you will get what you're looking for.

If you have to do this using enter image description here

Where:

  • () - grouping
  • d - matches any digit
  • - repetition
  • \ - escape of meta character

More information: JMeter Regular Expressions

  • Related