# How can I use  conditional regex as not true

**URL:** <https://forum.ansible.com/t/how-can-i-use-conditional-regex-as-not-true/28565>\
**Category:** Ansible Project\
**Created:** [September 13, 2018, 2:48pm UTC](https://forum.ansible.com/t/how-can-i-use-conditional-regex-as-not-true/28565 "2018-09-13T14:48:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Gupta](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Rahul\_Gupta](https://forum.ansible.com/u/Rahul_Gupta)\
**Post date:** [September 13, 2018, 2:48pm UTC](https://forum.ansible.com/t/how-can-i-use-conditional-regex-as-not-true/28565/1 "2018-09-13T14:48:56Z")

</div>

I’m running into trouble to find the answer that how to negate the conditional with regex. Something like below:

- debug: msg=“{{ Hello World}}”  
when:- test.rc !=0

- test.stderr | find (‘(No Such File or Directory)’)

- debug: msg=“{{ Hello Friend}}”  
when:

- test.rc !=0

- \<would like to use negate of “test.stderr | find (‘(No Such File or Directory)’)”\>

Looking for the expert help on this !

Thanks

---

<div class="post-metadata">

**Author:** ![Dennis\_McCarthy](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@Dennis\_McCarthy](https://forum.ansible.com/u/Dennis_McCarthy)\
**Post date:** [September 13, 2018, 7:15pm UTC](https://forum.ansible.com/t/how-can-i-use-conditional-regex-as-not-true/28565/2 "2018-09-13T19:15:05Z")

</div>

- rest.rc != 0
- ‘No Such File or Directory’ not in test.stderr

---

<div class="post-metadata">

**Author:** ![Rahul\_Gupta](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Rahul\_Gupta](https://forum.ansible.com/u/Rahul_Gupta)\
**Post date:** [September 14, 2018, 8:08am UTC](https://forum.ansible.com/t/how-can-i-use-conditional-regex-as-not-true/28565/3 "2018-09-14T08:08:12Z")

</div>

Thanks will try!!
