Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread John Harmon
On Friday, November 2, 2018 at 2:40:07 PM UTC-6, Brad Van Orden wrote: > > I knew it wasn't ansible, but just didn't have quick access to test it. > So, gave sed so that he could see a working regex. :) > > On Fri, Nov 2, 2018 at 12:52 PM John Harmon > wrote: > >> Awesome, thanks guys! Kai,

Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread Brad Van Orden
I knew it wasn't ansible, but just didn't have quick access to test it. So, gave sed so that he could see a working regex. :) On Fri, Nov 2, 2018 at 12:52 PM John Harmon wrote: > Awesome, thanks guys! Kai, I am unsure if I would have got that one my > own. I can see what it is doing now, but

Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread John Harmon
Awesome, thanks guys! Kai, I am unsure if I would have got that one my own. I can see what it is doing now, but is near voodoo to me. I thought I understood backrefs at a very basic level, but this proves I have a long way to go. Thank you. > > -- You received this message because you

Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread Kai Stian Olstad
On Thursday, 1 November 2018 23:58:59 CET John Harmon wrote: > I have been thinking about doing this with lineinfile with backrefs, or > with the replace module, but I am at a loss as to where to start (I am > horrible with regexp) > > Consider the following: > vif =

[ansible-project] regexp help? Replace part of string

2018-11-01 Thread John Harmon
I have been thinking about doing this with lineinfile with backrefs, or with the replace module, but I am at a loss as to where to start (I am horrible with regexp) Consider the following: vif = ['mac=00:21:f6:A1:B7:49,bridge=1053d3f53c'] I would like to replace the last three octets, but

Re: [ansible-project] regexp help.....

2017-09-22 Thread John Harmon
Kai Stian Olstad, thank you! You are right, that worked. I tried my previous one at https://regex101.com/ and selected Python, but I guess it isn't 100% the same. I will have to keep that in mind. On Thursday, September 21, 2017 at 11:53:37 PM UTC-6, Kai Stian Olstad wrote: > > On 22. sep.

Re: [ansible-project] regexp help.....

2017-09-21 Thread Kai Stian Olstad
On 22. sep. 2017 01:08, John Harmon wrote: This works under a regexp tester, but fails under ansible. I don't know how to correct it. You need to use a Python based one, since Ansible is using Python re. Basically, it finds the lines starting with passwd or group, looks in the lines for

[ansible-project] regexp help.....

2017-09-21 Thread John Harmon
This works under a regexp tester, but fails under ansible. I don't know how to correct it. Basically, it finds the lines starting with passwd or group, looks in the lines for sss, and appends if it isn't found. - name: Update nsswitch.conf replace: path: /etc/nsswitch.conf regexp: