Hello,
I have long response and i want to count a number of word (“good”) in response. Can i do it? I tried to do something like “var count = pm.response.json().match(“good”)”, but it doesn’t work.
Hello,
I have long response and i want to count a number of word (“good”) in response. Can i do it? I tried to do something like “var count = pm.response.json().match(“good”)”, but it doesn’t work.
Hey @lissiamsn,
Welcome to the community!
Not actually tried this out so it might not work but it’s worth a try
let str = pm.response.text();
console.log(str.split("good").length - 1);
It’s using pm.response.text()
as that converts the response to text.
Thank you! It’s work!