I'm thinking the problem is that it is allowing any character to match [^#] --- including newline, which you likely do not expect. Try [^#\n] instead.
On Fri, Nov 6, 2015 at 5:45 PM, Edward Ned Harvey (lopser) < lop...@nedharvey.com> wrote: > I want ansible to comment-out all lines in a file, if they aren't already > commented out. Here's what I have: > > > > replace: dest=/etc/httpd/conf.d/welcome.conf regexp='(^[^#].*)' replace='# > \1' > > > > The problem is, the file has some blank lines. When ansible encounters a > blank line, it comments it out, and then for some reason, skips the next > line. I'm thinking maybe there's a bug in the way ansible is handling those > lines ... Or more likely, I've got something screwed up in my regex. > > > > I thought maybe it was using the '.*' to include the newline and the whole > next line, so I changed it to '.?' with no effect. > > > > I'm also noticing, a blank line shouldn't match the ^[^#] pattern, because > it doesn't begin with not pound. > > > > Anyway, do you fine people think I've uncovered a bug? Or I've got a > buggered regex? > > _______________________________________________ > Tech mailing list > Tech@lists.lopsa.org > https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech > This list provided by the League of Professional System Administrators > http://lopsa.org/ > > -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/