How to use RegEx expression in utilFindInResponse FiddlerScript

Viewed 36

I want to find the string "wallet":10000000, and use oSession.utilFindInResponse(/"wallet":([0-9.]+),/,0); but return -1.

How do I use regular expressions to search for a string FiddlerScript?

1 Answers

oSession.utilFindInResponse is according to the Fiddler documentation defined to perform a string search. Regular expressions are not mentioned and thus not supported using this command.

Assuming the response consists of text (e.g. a html page or a JSON file) you can get the response body as String and the apply the standard .Net commands for regular expression search:

var bodyString = oSession.GetResponseBodyAsString();
var regex = /\"wallet\":([0-9.]+)/;
if (regex.test(bodyString)) {
   ... 
}
Related