# Format to specify two regex in contains parameter in find module

**URL:** <https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739>\
**Category:** Ansible Project\
**Created:** [June 7, 2018, 6:01pm UTC](https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739 "2018-06-07T18:01:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saranya\_N](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Saranya\_N](https://forum.ansible.com/u/Saranya_N)\
**Post date:** [June 7, 2018, 6:01pm UTC](https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739/1 "2018-06-07T18:01:05Z")

</div>

I want to grep for two words in contains attribute.

It doesn't work if I give like this to search for patterns scm.com and DD:

Contains: .\*scm\.com.\* , dd\:

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 8, 2018, 7:01pm UTC](https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739/2 "2018-06-08T19:01:03Z")

</div>

The contains in find only check one line at the time, so you cant create regex that expand multiple line.  
If your expression is on the same line you can use  
&nbsp;&nbsp;&nbsp;.\*scm\.com.\*dd\:

It it's on multiple line you need to run one find to find files containing the first expression, and the run a second find on the result to check for the second expression.

So it might be easier to use command or shell.

---

<div class="post-metadata">

**Author:** ![Saranya\_N](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Saranya\_N](https://forum.ansible.com/u/Saranya_N)\
**Post date:** [June 9, 2018, 4:39am UTC](https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739/3 "2018-06-09T04:39:04Z")

</div>

Oh I wasn’t aware of that ! Thank you Kia.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 9, 2018, 6:18am UTC](https://forum.ansible.com/t/format-to-specify-two-regex-in-contains-parameter-in-find-module/27739/4 "2018-06-09T06:18:40Z")

</div>

Neither did I, I had to read the source code to find out.
