Re: [ansible-project] Help Using an .stdout as a VAR Used in a WHEN Condition

2024-01-09 Thread Todd Lewis
*$ cat symianarmy01.yml* --- # symianarmy01.yml - name: Reading number from a file hosts: localhost gather_facts: false vars: *fname: /tmp/impact.txt content: ' -12268.06'* tasks: - name: Create our temporary file ansible.builtin.copy: content: '{{ content }}'

Re: [ansible-project] backslashes in regex_replace filter

2024-01-09 Thread Rob Wagner
But the \1 is also inside single and double quotes, so if that were the reason, I wouldn’t have to double backslash the 1On Jan 9, 2024, at 9:19 AM, 'Rowe, Walter P. (Fed)' via Ansible Project wrote: Perhaps because you have single quotes inside double quotes so everything inside the single q

Re: [ansible-project] backslashes in regex_replace filter

2024-01-09 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
Perhaps because you have single quotes inside double quotes so everything inside the single quotes is automatically escaped? Walter -- Walter Rowe, Division Chief Infrastructure Services Division Mobile: 202.355.4123 On Jan 9, 2024, at 9:04 AM, Rob Wagner wrote: Right, but why doesn’t the \\d

Re: [ansible-project] backslashes in regex_replace filter

2024-01-09 Thread Rob Wagner
Right, but why doesn’t the \\d need to be double-backslashed?  Backslash-d is regex for matching on a digit.  I just don’t get why doubling the backslash is needed on the 1 but not on the d.On Jan 9, 2024, at 7:53 AM, 'Rowe, Walter P. (Fed)' via Ansible Project wrote: The \\1 must be double-b

Re: [ansible-project] backslashes in regex_replace filter

2024-01-09 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
regex_replace('^p(\d+).*$', '\\1') '\\1' in the second argument is a "backref" (backwards reference) to the (\d+) in the first argument. It seems it is looking for an expression with digits and extracting the digits. Your list 't' has names with p1_xyz, p2_xyz, p4_xyx so this regex would extrac

Re: [ansible-project] backslashes in regex_replace filter

2024-01-09 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
The \\1 must be double-backslashed because the backref needs to be backslash-digit (\1). Doubling the backslash escapes the backslash. Walter -- Walter Rowe, Division Chief Infrastructure Services Division Mobile: 202.355.4123 On Jan 8, 2024, at 6:57 PM, Rob Wagner wrote: Thanks Matt, but I st