Keep characters in substitution with regex in gedit

2

I have the following text segment in a .csv file

5/29/17;08:17;Fulano;Teatro Companhia
Rua do Canto, 301/305
Esquina da rua meio
De segunda a sexta das 9h as 18h
5/29/17;08:18;Ciclano;legal

I need to have lines 2,3 and 4 together with line 1 separated by "|" and for this I used the following regular expression to find line breaks that do not start with a number

\n[^[0-9]

But when I ask to replace it it deletes the first letter of each line and the file looks like this:

5/29/17;08:17;Fulano;Teatro Companhia|ua do Canto, 301/305|squina da rua meio|e segunda a sexta das 9h as 18h
5/29/17;08:18;Ciclano;legal

I would like to know how I can use an expression that locates the desired occurrences without deleting characters that start the next line.

I'm using the Gedit program to do this, with the find and replace command.

    
asked by anonymous 16.08.2017 / 17:15

1 answer

2

You need to use a positive lookahead :

\n(?=[^0-9])

This operator makes regular expression see if the next character matches the given expression. In this case, it verifies that the character after the new line \n is not a number.

You can see an example here (in C #).

    
16.08.2017 / 17:24