# How to avoid backslash and quote from variable

**URL:** <https://forum.ansible.com/t/how-to-avoid-backslash-and-quote-from-variable/30035>\
**Category:** Ansible Project\
**Created:** [April 2, 2019, 2:58am UTC](https://forum.ansible.com/t/how-to-avoid-backslash-and-quote-from-variable/30035 "2019-04-02T02:58:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bikram](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Bikram](https://forum.ansible.com/u/Bikram)\
**Post date:** [April 2, 2019, 2:58am UTC](https://forum.ansible.com/t/how-to-avoid-backslash-and-quote-from-variable/30035/1 "2019-04-02T02:58:09Z")

</div>

Hello,

I am running an audit against some interfaces on Cisco switches:  
Here is the task:

- ios\_command:  
provider: “{{ cli }}”  
commands: show run interface “{{ item }}” | i no cdp  
timeout: 15  
register: no\_cdp  
with\_items: “{{ interface\_all.stdout\_lines }}”

From with\_items the value of variables passing as “show run interface "Gi9/1" | i no cdp” which gives me an error as it has " in both leading and trailing side of interface name.

I tried | regex\_replace after item to avoid these two characters but no luck.

Could you please help.

Thanks,  
Bikram Biswas

---

<div class="post-metadata">

**Author:** ![P\_Varsha](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@P\_Varsha](https://forum.ansible.com/u/P_Varsha)\
**Post date:** [April 3, 2019, 6:28am UTC](https://forum.ansible.com/t/how-to-avoid-backslash-and-quote-from-variable/30035/2 "2019-04-03T06:28:21Z")

</div>

Hello,  
I am not working on cisco switches but try once - "show run interface “\Gi9/1" | i no cdp” .  
check your commands once your using - "show run interface " right because of that you got error.

Thanks

---

<div class="post-metadata">

**Author:** ![Bikram](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Bikram](https://forum.ansible.com/u/Bikram)\
**Post date:** [April 3, 2019, 1:07pm UTC](https://forum.ansible.com/t/how-to-avoid-backslash-and-quote-from-variable/30035/3 "2019-04-03T13:07:37Z")

</div>

Hi  
Thanks for your feedback  
I solved it using regular expression

Bikram
