# lineinfile with a backslash in the regexp field

**URL:** <https://forum.ansible.com/t/lineinfile-with-a-backslash-in-the-regexp-field/21876>\
**Category:** Ansible Project\
**Created:** [June 28, 2016, 2:01pm UTC](https://forum.ansible.com/t/lineinfile-with-a-backslash-in-the-regexp-field/21876 "2016-06-28T14:01:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fanvalt](https://avatars.discourse-cdn.com/v4/letter/f/2bfe46/32.png) [@fanvalt](https://forum.ansible.com/u/fanvalt)\
**Post date:** [June 28, 2016, 2:01pm UTC](https://forum.ansible.com/t/lineinfile-with-a-backslash-in-the-regexp-field/21876/1 "2016-06-28T14:01:23Z")

</div>

Hello,

I would like to replace the following line:  
jstl.jar,taglibs-standard-spec-_.jar\*\*,\*_

with:  
jstl.jar,taglibs-standard-spec-\*.jar,icu4j-2.6.1.jar,\

I tried to double the backslash without any success, the issue occurs only on the regexp backslash:

For example, when doing this:

- name: catalina.properties jstl  
lineinfile:  
dest: /{{ tomcatdir }}/conf/catalina.properties  
regexp: “^jstl.jar,taglibs-standard-spec-_.jar\_\_,._\_\_”  
line: “jstl.jar,taglibs-standard-spec-\*.jar,icu4j-2.6.1.jar,\”

I have no error but an extra line as it does not recognize the line to replace, I thought ‘.’ was meaning any character and ‘\*’ as many as we want.  
When using this one:

regexp: “^jstl.jar,taglibs-standard-spec-_.jar\*\*,\*\*"  
line: "jstl.jar,taglibs-standard-spec-_.jar,icu4j-2.6.1.jar,\”

I have a syntax error.

Can you help me about using the backslash in the regexp parameter, without being a special character ?

Regards
