# do-until loop with find function and regulare expression

**URL:** <https://forum.ansible.com/t/do-until-loop-with-find-function-and-regulare-expression/25474>\
**Category:** Ansible Project\
**Created:** [September 13, 2017, 3:42pm UTC](https://forum.ansible.com/t/do-until-loop-with-find-function-and-regulare-expression/25474 "2017-09-13T15:42:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narahari\_n\_Savitha](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Narahari\_n\_Savitha](https://forum.ansible.com/u/Narahari_n_Savitha)\
**Post date:** [September 13, 2017, 3:42pm UTC](https://forum.ansible.com/t/do-until-loop-with-find-function-and-regulare-expression/25474/1 "2017-09-13T15:42:43Z")

</div>

Freinds:

Thank you for your time and attention on this, in advance.

I have the following do-until loop and I am trying to understand how to match regurlar experssions.

…  
…

shell: “curl -sk -m 2 [http://localhost:8080/Log4JControl/version.jsp](http://localhost:8080/Log4JControl/version.jsp)”  
register: result  
until: result.stdout.find(“3.6.2.85”) != -1  
retries: 60  
delay: 10

The find function takes a string that varies from each server to server.

The 3.6.2.85 is not a constant. I want to be able to match 3.\*. I get an empty string for almost 4 mintutes but then I will get 3.x…x

Is that function find coming from Python ?

Where can I find more documentation on that find command to see if it can match regex ?

Regards,  
-Narahari

---

<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:** [September 13, 2017, 5:09pm UTC](https://forum.ansible.com/t/do-until-loop-with-find-function-and-regulare-expression/25474/2 "2017-09-13T17:09:47Z")

</div>

> Is that function find coming from Python ?

yes

> Where can I find more documentation on that find command to see if it can  
> match regex ?

Python docs. But it doesn't support regexp, only string.

What you are looking for is regexp filters  
[https://docs.ansible.com/ansible/latest/playbooks\_filters.html#regular-expression-filters](https://docs.ansible.com/ansible/latest/playbooks_filters.html#regular-expression-filters)

---

<div class="post-metadata">

**Author:** ![Narahari\_n\_Savitha](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Narahari\_n\_Savitha](https://forum.ansible.com/u/Narahari_n_Savitha)\
**Post date:** [September 14, 2017, 2:28am UTC](https://forum.ansible.com/t/do-until-loop-with-find-function-and-regulare-expression/25474/3 "2017-09-14T02:28:13Z")

</div>

It worked. Thank You.
