# Escaping special characters in regex\_replace with '\\' fails with: unknown escape character

**URL:** <https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563>\
**Category:** Ansible Project\
**Created:** [February 3, 2021, 6:49pm UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563 "2021-02-03T18:49:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![actionmystique](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/actionmystique/32/1678_2.png) [@actionmystique](https://forum.ansible.com/u/actionmystique)\
**Post date:** [February 3, 2021, 6:49pm UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/1 "2021-02-03T18:49:44Z")

</div>

ansible: **2.10.5** (with pip3 install)  
python version = 3.9.1+ (default, Jan 20 2021, 14:49:22) [GCC 10.2.1 20210110]

Escaping special characters in the searched string such as the following should be simply done with '':

- ’ → '
- ( → (
- , → ,
- ) → )

However, it seems to be impossible to perform this task with a single '' or even a double ‘\’; for instance, running the following playbook fails:

```auto

---
- name: Escaping special characters in regex_replace fails
hosts:
- localhost
strategy: debug
vars:
searched_string: "('string_a', 'string_b'),('string_c', 'string_d')"
tasks:
- name: Escaping with '
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing? - Result expected is “string\_a@string\_b,string\_c@string\_d”  
set\_fact:  
replaced\_string: "{{ searched\_string |  
regex\_replace('(  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing? - Result expected is "string_a@string_b,string_c@string_d"
set_fact:
replaced_string: "{{ searched_string |
regex_replace('\(
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing? - Result expected is “string\_a@string\_b,string\_c@string\_d”  
set\_fact:  
replaced\_string: "{{ searched\_string |  
regex\_replace('(  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing? - Result expected is "string_a@string_b,string_c@string_d"
set_fact:
replaced_string: "{{ searched_string |
regex_replace('\(
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing? - Result expected is “string\_a@string\_b,string\_c@string\_d”  
set\_fact:  
replaced\_string: "{{ searched\_string |  
regex\_replace('(  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing? - Result expected is "string_a@string_b,string_c@string_d"
set_fact:
replaced_string: "{{ searched_string |
regex_replace('\(
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing? - Result expected is "string_a@string_b,string_c@string_d"
set_fact:
replaced_string: "{{ searched_string |
regex_replace('\(
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?,  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)  
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)
leads to:

```

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:  
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.  
found unknown escape character

The error appears to be in ‘escape\_special\_characters\_in\_regex\_replace.yml’: line 16, column 53, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced\_string: "{{ searched\_string |  
regex\_replace('(

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?]+)

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?([^

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
…

```auto
leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

b702431fec70586338fe4dcb8fe784cd

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?)', ‘\1@\2’) }}"  
^ here

```auto

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
...

```

leads to:

```auto

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
found unknown escape character

The error appears to be in 'escape_special_characters_in_regex_replace.yml': line 16, column 53, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

replaced_string: "{{ searched_string |
regex_replace('\(

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\, 

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?([^

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?]+)

I thought about using the jinja2 'replace' filter to remove all special characters first, but that would just be throwing the can down the road, right? ;-)

What am I missing?\)', '\1@\2') }}"
^ here

```

I thought about using the jinja2 ‘replace’ filter to remove all special characters first, but that would just be throwing the can down the road, right? 😉

What am I missing?

---

<div class="post-metadata">

**Author:** ![actionmystique](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/actionmystique/32/1678_2.png) [@actionmystique](https://forum.ansible.com/u/actionmystique)\
**Post date:** [February 3, 2021, 6:56pm UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/2 "2021-02-03T18:56:47Z")

</div>

I meant kicking …, but you got the idea.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [February 3, 2021, 6:57pm UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/3 "2021-02-03T18:57:57Z")

</div>

Hi,

the problem is that you're inside a YAML " " string, which already  
interprets escaping.

Try using `\>-` or something like that ([https://yaml-multiline.info/](https://yaml-multiline.info/))  
instead of double quotes for the string that's templated, like

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replaced\_string: \>-  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ searched\_string | regex\_replace(  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'\(\'([^\']+)\'\, \'([^\']+)\'\)', '\\1@\\2') }}

Then it should work.

(Alternatively, if you use " ", you need to double escape - which is  
extremely ugly to read.)

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 4, 2021, 12:44am UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/4 "2021-02-04T00:44:49Z")

</div>

FWIW, create lists and join the items

&nbsp;&nbsp;&nbsp;&nbsp;- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replaced\_string: "{{ searched\_lists|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map('join', '@')|list|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;join(',') }}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pleft: '\('  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pright: '\)'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bleft: '['  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bright: ']'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;searched\_lists: "{{ searched\_string|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;regex\_replace(pleft, bleft)|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;regex\_replace(pright, bright) }}"

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 4, 2021, 7:28am UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/5 "2021-02-04T07:28:29Z")

</div>

This simplified version gives the same result

&nbsp;&nbsp;&nbsp;&nbsp;- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replaced\_string: "{{ searched\_lists|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map('join', '@')|list|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;join(',') }}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;searched\_lists: "{{ '[' ~ searched\_string ~ ']' }}"

---

<div class="post-metadata">

**Author:** ![actionmystique](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/actionmystique/32/1678_2.png) [@actionmystique](https://forum.ansible.com/u/actionmystique)\
**Post date:** [February 4, 2021, 3:03pm UTC](https://forum.ansible.com/t/escaping-special-characters-in-regex-replace-with-fails-with-unknown-escape-character/34563/6 "2021-02-04T15:03:09Z")

</div>

@Felix Fontein  
I tried to replace the double-quotes with:

- 

> -: “An unhandled exception occurred while templating”

- '\>: “An unhandled exception occurred while templating”

@Vladimir Botka  
Fantastic 🙂  
I chose the last version.
