On Mon, 21 Sep 2020 at 21:31,
rajtheco...@gmail.com
<
rajtheco...@gmail.com> wrote:
>
> Hi Bob,
>
> here my code I removed '^' still not working
>
> - set_fact:
> console: "{{ current_show_run[0] | map('regex_search', qry, multiline=True | select('string') | list }}"
> vars:
> qry: '^line con.*\n\spassword'
This list is for discussions about Ansible development. The Ansible
Project mailing list would be the right forum for your question. See
https://docs.ansible.com/ansible/latest/community/communication.html
for details.
The approach you are using works as expected in this test (caret included):
```
$ ansible localhost -m debug -a msg="{{ lines|map('regex_search',
'^line con.*\n^\s(.*)', multiline=True)|select('string')|list }}" -e
'{"lines":["foo\nbar","line console 0\n password","mine console
1\npassword","line console 2\nnospaceword","line console 3\n
otherpassword"]}'
localhost | SUCCESS => {
"msg": [
"line console 0\n password",
"line console 3\n otherpassword"
]
}
```
Either the input data you're feeding it isn't what you expect, or your
pattern doesn't match the correct input.
-- Abhijit