Yap, that works, it's .net regexp after all /me silly. Thx for pointing it out
Also, regading this module the idempotence is slightly broken - I've opened an issue <https://github.com/ansible/ansible-modules-core/issues/3381#issuecomment-206840657> (and provided a dirty fix) On Wednesday, April 6, 2016 at 9:35:39 PM UTC+2, J Hawkesworth wrote: > > Not used this module myself but I think perhaps you need to use $1 > instead of \1 > > Have a look at the integration tests for this module here: > > > https://github.com/ansible/ansible/blob/devel/test/integration/roles/test_win_lineinfile/tasks/main.yml > > There's a task that looks like this > > > - name: replace a line with backrefs included in the line > win_lineinfile: dest={{win_output_dir}}/test.txt state=present line="New > $1 created with the backref" backrefs=yes regexp="^This is (line 4)$" > > hence suggestion to try using $1 > > HTH > > Jon > > > On Wednesday, 6 April 2016 17:46:49 UTC+1, [email protected] wrote: >> >> Hello great people of ansible persuasion, >> >> I'm trying to do some *win_lineinfile *with *backrefs.* >> >> Being a core module, it could be I'm doing it wrong, so here it goes - >> let me know if you have any clue: >> >> win_lineinfile: >> dest: c:\Windows\System32\inetsrv\config\applicationHost.config >> regexp: '^(.*)<urlCompression \/>$' >> line: '\1<urlCompression doStaticCompression="true" >> doDynamicCompression="true" />' >> state: present >> backrefs: yes >> backup: yes >> >> It's runninng against this >> >> <urlCompression /> >> >> and after execution I end up with this >> >> \1<urlCompression doStaticCompression="true" doDynamicCompression="true" >> /> >> >> it does the job, but i get the \1 instead of the group of spaces. Am I >> missing anything? >> >> >> >> Brussels · New York · stylelabs.com <http://marketingcontenthub.com/> >> ------------------------------ >> >> *Join our team and help us create and innovate ⓜ Marketing Content Hub, >> one of the most user-friendly content marketing tools on the market.* >> >> Belgium: Senior Web Developer >> <http://stylelabs.com/en/about-us/jobs/opportunities/javascript-developer/> >> - Senior Dotnet Developer >> <http://stylelabs.com/en/about-us/jobs/opportunities/senior-net-developer/> >> - Dotnet Developer >> <http://stylelabs.com/en/about-us/jobs/opportunities/net-developer/> - >> Project >> Manager >> <http://stylelabs.com/en/about-us/jobs/opportunities/project-manager/> >> - Solution Architect >> <http://stylelabs.com/en/about-us/jobs/opportunities/solution-architect/> >> - Business Analyst >> <http://stylelabs.com/en/about-us/jobs/opportunities/business-analyst/> >> United States: Senior Dotnet Developer >> <http://stylelabs.com/en/about-us/jobs/opportunities/net-developer-greater-philadelphia-area/> >> > -- Brussels · New York · stylelabs.com <http://marketingcontenthub.com/> ------------------------------ *Join our team and help us create and innovate ⓜ Marketing Content Hub, one of the most user-friendly content marketing tools on the market.* Belgium: Senior Web Developer <http://stylelabs.com/en/about-us/jobs/opportunities/javascript-developer/> - Senior Dotnet Developer <http://stylelabs.com/en/about-us/jobs/opportunities/senior-net-developer/> - Dotnet Developer <http://stylelabs.com/en/about-us/jobs/opportunities/net-developer/> - Project Manager <http://stylelabs.com/en/about-us/jobs/opportunities/project-manager/> - Solution Architect <http://stylelabs.com/en/about-us/jobs/opportunities/solution-architect/> - Business Analyst <http://stylelabs.com/en/about-us/jobs/opportunities/business-analyst/> United States: Senior Dotnet Developer <http://stylelabs.com/en/about-us/jobs/opportunities/net-developer-greater-philadelphia-area/> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/346adc1e-ea40-461a-926a-49ee5f279cb2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
