Regex to remove everything after a new line

3.6k Views Asked by At

It seems simple, but I don't get it to work. I wan't to delete everything after something..... but I only get to delete line 1. example :

  1. this is line 1
  2. this is line 2
  3. this is line 3
  4. this is line 4

I get to delete line 1, but not 2,3 and 4.

Some tips ?

More information : I tried to do this in Yahoo pipes.

I like to delete everything after : </div></a></div>

1

There are 1 best solutions below

1
Edward L. On

Try this regex:

\n.*

That should match anything after a new line. I used the following command in vim and it deleted lines 2, 3, and 4.

:%s/\n.*//g

I think you need to provide more details like the tool you are using, etc.