Home > OS >  How to Extract Value From Response Header with 302 Status Code?
How to Extract Value From Response Header with 302 Status Code?

Time:02-24

I've been trying to extract value from a response header. I tried using RegEx and Boundary Extractor but I coudln't make it. And that request always gives a 302 response code.

My Response Header:

HTTP/1.1 302 
server: nginx
date: Wed, 23 Feb 2022 12:35:19 GMT
content-length: 0
x-frame-options: SAMEORIGIN
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
strict-transport-security: max-age=31536000 ; includeSubDomains
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
location: https://somedomainname.com/tr/checkout/orderConfirmation/2202231535500
content-language: tr
connection: close

What I want to extract is order confirmation number: 2202231535500 , which will be coming as a dynamic value during testing.

CodePudding user response:

Use

orderConfirmation/([0-9] )

See regex proof.

EXPLANATION

--------------------------------------------------------------------------------
  orderConfirmation/       'orderConfirmation/'
--------------------------------------------------------------------------------
  (                        group and capture to \1:
--------------------------------------------------------------------------------
    [0-9]                    any character of: '0' to '9' (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
  )                        end of \1
  • Related