# Check if response at specific location contains one of the words

**URL:** <https://community.postman.com/t/check-if-response-at-specific-location-contains-one-of-the-words/30738>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [December 15, 2021, 3:11pm UTC](https://community.postman.com/t/check-if-response-at-specific-location-contains-one-of-the-words/30738 "2021-12-15T15:11:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nonikoff](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@nonikoff](https://community.postman.com/u/nonikoff)\
**Post date:** [December 15, 2021, 3:11pm UTC](https://community.postman.com/t/check-if-response-at-specific-location-contains-one-of-the-words/30738/1 "2021-12-15T15:11:21Z")

</div>

_My question_:  
I want to check if response at specific location contains any word from the list. If YES return an id of that document (or console.log id)  
Here it is  
[https://www.postman.com/nonikoff/workspace/rabota-ua/overview](https://www.postman.com/nonikoff/workspace/rabota-ua/overview)

body contains array of **“documents”: []**  
each document contains **“experience”: []**  
I’m traying to check if **experience** contains some string at **company**

For this I have a Test  
pm.test(“Check if responce at documents[i].experience[k].company contains one of the next words”, function() {

```
var response = pm.response.json();  

for (let i = 0; i < response.documents.length; i++) {

    for (let k = 0; k < response.documents[i].experience.length; k++) {

    pm.expect(response.documents[i].experience[k].company.toLowerCase()).to.satisfy(function(item) {

        console.log(response.documents[i].url, (item.indexOf("поліція") > -1) || (item.indexOf("эпицентр") > -1));

        return(item.indexOf("поліція") > -1) || (item.indexOf("эпицентр") > -1);

    });

    }

}

```

});

but it checks first 3 documents from 5  
Thanks in advance
