Try this: Location: [\S]+?confirmationNumber=(\d+)
Your issue is the use of special characters in the string without escaping them - e.g.: ?
and /
Note my ?
is not matching the question mark in front of confirmationNumber, but instead is making the [\S]+
non-greedy.
If you want to be explicit, your version should work if modified like this to escape the characters with special meaning:
Location: http:\/\/test.regtest.com\/cart\/confirmation\?confirmationNumber=(\d+)?