# Match multiple consecutive lines in lineinfile

**URL:** <https://forum.ansible.com/t/match-multiple-consecutive-lines-in-lineinfile/18787>\
**Category:** Ansible Project\
**Created:** [July 16, 2015, 9:44pm UTC](https://forum.ansible.com/t/match-multiple-consecutive-lines-in-lineinfile/18787 "2015-07-16T21:44:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phyks](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@Phyks](https://forum.ansible.com/u/Phyks)\
**Post date:** [July 16, 2015, 9:44pm UTC](https://forum.ansible.com/t/match-multiple-consecutive-lines-in-lineinfile/18787/1 "2015-07-16T21:44:31Z")

</div>

Hi,

I need to add a specific line after some lines in a config file. Due to  
the structure of the file, I have to match several consecutive lines to  
ensure the line will go to the right place (and I know about template  
and copy, but they won't fit my needs in this case).

My problem is that is seems the regexp argument in Ansible does not  
match "\n", contrary to the line argument.

Is there a workaround?

Thanks!
