I have a local txt file called file-names.txt that contains a list of filenames

```
file1.txt
file2.txt
file3.txt

```

In my ansible-playbook I'm registering the file contents of file-name.txt using the slurp module.
And setting a fact named `files_names`.

```
tasks:
 - name: Getting the file
   ansible.builtin.slurp:
    src: file-name.txt
   register: file_names
 - name: Saving the file names
   set_fact: 
     file_name_list: "{{ (file_name['content] | b64decode | trim ).split('\r\n') }}"

```

I want the `file_name_list` fact to be a list just containing the file names. but some how split function is not able to remove the `'\r'` from the file names and I get the following results

```
ok: [localhost] => {
  "ansible_facts":{
     "file_name_list": [
       "file1.txt\r",
       "file2.txt\r",
       "file3.txt"       
      ]
  },
  "changed": false
}

```

How can I remove the carriage return `'\r'` from each element of the array so that `file_name_list` looks like

```
ok: [localhost] => {
  "ansible_facts":{
     "file_name_list": [
       "file1.txt",
       "file2.txt",
       "file3.txt"       
      ]
  },
  "changed": false
}

```

PS: file-name.txt was made on a Windows machine, that's why there is a carriage return included in each line.