# win\_lineinfile | Regex

**URL:** <https://forum.ansible.com/t/win-lineinfile-regex/26852>\
**Category:** Ansible Project\
**Created:** [February 26, 2018, 3:50pm UTC](https://forum.ansible.com/t/win-lineinfile-regex/26852 "2018-02-26T15:50:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiago\_Pimpao](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@Tiago\_Pimpao](https://forum.ansible.com/u/Tiago_Pimpao)\
**Post date:** [February 26, 2018, 3:50pm UTC](https://forum.ansible.com/t/win-lineinfile-regex/26852/1 "2018-02-26T15:50:03Z")

</div>

Hi,  
I need to update a property in a file but the value i need to write depend of the inventory\_hostname.  
If the hostname is [ABCAPP1.MYDOMAIN.COM](http://ABCAPP1.MYDOMAIN.COM) the value i need to write is APP1  
If the hostname is [ABCDB1.MYDOMAIN.COM](http://ABCDB1.MYDOMAIN.COM) the value i nedd to write is DB1

How can i do this?  
Thanks,  
TP
