regex_replace filter

I have a list of strings like :

`
[hosts]
10.100.0.1
10.100.0.2
10.100.0.3

`

I am following the example under : https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html to “add “https://” prefix to each item in a list”
In my case I am appending the port number at the end of every item in the list and joining them with a “,” to get a string at the end. I am expecting to see something like:

` 10.100.0.1:2181,10.100.0.2:2181,10.100.0.3:2181 ` I am creating a variable as:

`

zookeeper_masters: “{{‘zk://’ + hosts | map(‘regex_replace’, ‘^(.*)$’, ‘\1:2181’) | join(‘,’)}}”

`

My result comes as:

`

“zk://10.100.0.1:2181:2181,10.100.0.2:2181:2181,10.100.0.3:2181:2181”

`

Can some one point out as to why I am getting the port number twice?

Please ignore this issue. It was a mistake in the next part of the play book that is causing the port to come twice.